Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 14:24
    db0 closed #478
  • 14:24
    db0 commented #478
  • 09:27
    db0 commented #462
  • 09:26
    seanieb commented #462
  • 01:22
    db0 edited #478
  • 01:22
    db0 edited #478
  • 01:21
    db0 commented #462
  • 01:11
    db0 labeled #478
  • 01:11
    db0 opened #478
  • Sep 24 23:47
    amotl commented #462
  • Sep 24 22:17
    db0 commented #462
  • Sep 23 18:45
    itsmostafa edited #477
  • Sep 23 18:43
    itsmostafa edited #477
  • Sep 23 18:41
    itsmostafa edited #477
  • Sep 23 18:41
    itsmostafa edited #477
  • Sep 23 18:40
    itsmostafa labeled #477
  • Sep 23 18:40
    itsmostafa opened #477
  • Sep 22 14:52
    db0 labeled #476
  • Sep 22 14:52
    db0 opened #476
  • Sep 21 09:39
    seanieb ready_for_review #475
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