Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 11 15:27
    seanieb commented #463
  • Aug 11 01:05
    plowman commented #463
  • Aug 08 11:36
    carlosvega commented #463
  • Aug 05 20:09
    amotl commented #463
  • Aug 05 12:51
    thedumbterminal commented #462
  • Aug 05 11:31
    app-generator commented #462
  • Aug 05 10:45
    jpiwek commented #460
  • Aug 05 10:18
    peter-doggart commented #462
  • Aug 05 10:15
    ziirish commented #462
  • Aug 05 10:05
    takshch commented #460
  • Aug 04 15:57
    silasary commented #462
  • Aug 04 12:56
    carlosvega commented #462
  • Aug 04 12:56
    carlosvega commented #460
  • Aug 04 12:52
    carlosvega commented #463
  • Aug 04 12:51
    carlosvega commented #463
  • Aug 04 12:42
    carlosvega commented #460
  • Aug 03 21:24
    paulogil2010 commented #462
  • Aug 03 16:40
    systemime commented #448
  • Aug 02 22:26
    plowman commented #463
  • Aug 02 21:45
    plowman synchronize #463
Brock Palen
@brockpalen
@harshalchaudhari35 skip_none= is what I wanted actually, and it works perfectly becaus depending on configuration different values in the nested group are populated. In our case does our campus HPC cluster have single precision GPUs or not,
Turns out mask= does something I hacked around by having a nasty lambda function in my model so that will clean that up significantly,
Really appreciate it, I need to get in the habbit of looking at the prototypes and not just the normal example documentation,
Harshal Chaudhari
@harshalchaudhari35
@brockpalen glad that helped and worked out for you. Yeah my experience has been the same and daunting with restx. Many times I find myself overriding many functions from the library.
Brock Palen
@brockpalen
NP, I really like the library, just wish it had more community behind it, it front ends out 14,000 CPU HPC cluster, and will soon front end our 20PB research archive, our univeristy really appreciates such an easy to understand library is available,
Brock Palen
@brockpalen
Maybe I'm not grocking it, but how do I input validation when for POST requests @api.route("/<string:subaccount>/user/<string:uniquename>") How do I do stricter validation of uniquename much like parsing payloads? Do I do it all manually in my routine? Or is there something more strict than <string:varname> ?
Harshal Chaudhari
@harshalchaudhari35
Ah what you are looking for is more of base flask functionality here. Flask provides a set of converters types to validate/typecast the route params. You can create your own converter types as mentioned here. https://uniwebsidad.com/libros/explore-flask/chapter-6/url-converters
If you don't want to define your own stuff and prefer a library doing it for you heres one https://github.com/Ge0rg3/flask-parameter-validation seems to support whitelists and regex validation
Brock Palen
@brockpalen
Thanks i'll check that out
Brock Palen
@brockpalen
BTW do POST requests have to have a payload if all the values in the model are optional? I found my unit tests fail unless I send an empty payload.
Harshal Chaudhari
@harshalchaudhari35
Short answer is yes :) You could get away with using content-length header set to 0 also
Brock Palen
@brockpalen
Weird, then why do I get a 500 rc if I don't pass data=json.dumps({})
dpeschman
@dpeschman
hello!
Ryan Truran
@RyanTruran
OAS3 allows for one response to have multiple schemas, through the use of oneOf, anyOf, allOf, not.
https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/
Does restx currently support this?
Matthew Jacobsen
@mjacobsen32
Can anyone offer some live support right now? I am having trouble with my routing. Keep getting 404 when routing to my API Blueprint, but the regular flask routes are getting reached just fine
Jamin Collins
@jamin.collins_gitlab
I'm having a bit of trouble with RequestParser and how to specify that an argument is a list of strings. From what I can find, action="append" should do it, but adding this appears to drop the element from the generated Swagger documentation.
Brock Palen
@brockpalen
Is there a flask library to generally protect against URL injection through routes? The flask security page didn't have anything that stuck out,
dpeschman
@dpeschman
@j5awry @ziirish Any ETA for the next bugfix release?
Giacomo Gritzan
@ggritzan_gitlab

I currently have problems with marshalling my Responses.

I am trying to do the following:

test_model = Model(
    "Test",
    {
        "_id": fields.String,
        "name": fields.String,
        "location": fields.String,
        "ip": fields.String,
    },
)

success_model = Model(
    "Success",
    {"data": fields.List(
        fields.Nested(test_model)
    )
    },
)

Without throwing any exception the data in the response is null

[{"status": "success", "data": null}']
Can somebody give me an advice?

Patrick Ray. Huang
@phuang07
hello all, I am new to restx, wondering when creating a model that has a one to many relationship, (e.g, order and order_items), how do i specify the field in the order model?
Tiago Tavares
@BigTava
Could enable the creation of models without automatically documenting, please?
It would be great to use @api.marshal_with(model) with multiple models, but not letting all of them be documented in swagger
John Chittum
@j5awry
FYI: i'm no longer a maintainer of python-restx. @ziirish is the final member left. I've removed my privs from Github. unfortunately, I have no time. and, honestly, i've started receiving personal emails asking about merges, etc. I don't have the capacity to deal with those.
1 reply
Honestly, at this point, flask-restx is so far behind so many projects in capabilities, even if we merged in a few things, it'd be worth users finding new frameworks
Benjamin "Ziirish" SANS
@ziirish
Thanks j5awry for your time and efforts so far!
And I agree with you about the new frameworks that have more traction
Piotr Borowy
@Piotrbov_gitlab
I too thank for work with this framework. Do you have some proposal in some framework to use instead of RestX?
DEEP SHAH
@shahdeep1908
Is there any tutorials for RestX with jinja as I am not able to find any documentaion on google for some frontend with RESTX.
Tiago Tavares
@BigTava
Which ones should I use
I agree. Restx is quite limited
victoralv
@victoralv8_twitter
Hello, can someone helpme with a Wildcard setting?
What i'm trying to do is to specify the structure of my Wildcard, i want it to be input* instead of just *
This message was deleted
from flask import Flask
from flask_restx import Resource, Api, fields

api = Api()
app = Flask(__name__)
api.init_app(app)

input_model = api.model('Input', {
    'type': fields.String,
    'topic': fields.String,
})

output_model = api.model('Output', {
    'type': fields.String,
    'topic': fields.String,
})

@api.route('/input')
class Input(Resource):
    @api.marshal_with(input_model, envelope='resource')
    def get(self):
        return {'hello': 'world'}

@api.route('/output')
class Output(Resource):
    @api.marshal_with(output_model, envelope='resource')
    def get(self):
        return {'hello': 'world'}

control_model = api.model('Control', {
    'name': fields.String,
    'address': fields.String,
    'inputs': fields.Wildcard(fields.Nested(input_model)),
    'outputs': fields.Wildcard(fields.Nested(output_model)),
})


@api.route('/control')
class Control(Resource):
    @api.marshal_with(control_model, envelope='resource')
    def get(self):
        return {'hello': 'world'}

if __name__ == '__main__':
    app.run(debug=True)
image.png
This is the structure on swagger
I want instead of * have input* and output*, to accept a object like
control = {
 'name': 'Main Control',
 'address': '100.100.100.100',
  'input1':{},
  'input2':{},
  'output1':{},
  'output3':{},
}
victoralv
@victoralv8_twitter
image.png