Skip to content

expects vs params #645

Description

@leberknecht

Ask a question
When i have something like this:

@my_api.expect(input_model)

with the model being:

input_model = my_api.model('InputDataModel', {
    'customerNumber': fields.String(
        description='Customer number that was stored',
        example='801000000029'
    )
...
})

It adds a parameter to the swagger.json named payload which is just an json-object.
When i use something like this:

 @my_api.doc(
        params={
            'customerNumber': {
                'description': 'Customer ID (required)',
                'in': 'body',
                'type': 'string',
                'required': True,
                'example': '702000000020'
            },

it defines the field properly in the swagger.json. If i add both, i get both, so the sandbox would add a field payload to the outgoing request. I think either expect should create the same fields as using params= does, no? Am i missing something?

Additional context

% pip list | grep -i flask
Flask                     3.0.3
flask-cors                6.0.1
flask-restx               1.3.2
Flask-SQLAlchemy          3.1.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions