Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderingFilter causing Parser error: unknown tag when using OpenAPI schema #1135

Closed
dennishylau opened this issue Oct 14, 2019 · 4 comments
Closed

Comments

@dennishylau
Copy link

Specifically, the description field generated was problematic.
e.g.

/api/{version}/business/brand/:
    get:
      operationId: listBrands
      parameters:
      ...
      - name: ordering
        required: false
        in: query
        description: &id001 !!python/object/apply:django.utils.functional._lazy_proxy_unpickle
        - !!python/name:django.utils.translation.gettext ''
        - !!python/tuple
          - Ordering
        - {}
        - !!python/name:builtins.str ''
        schema:
          type: string

So when swagger-ui is loading the schema, this shows up

Errors
Hide
 
Parser error on line 638
unknown tag !<tag:yaml.org,2002:python/name:django.utils.translation.gettext>

To get around this, I must set the label attribute when

ordering = OrderingFilter(fields=(...), label='Hello World')

Thank you.

@carltongibson
Copy link
Owner

Ah, yes. We’ll need a str() somewhere.

@legioz
Copy link

legioz commented Apr 15, 2021

image
image

This same error is occurring with my project.

@carltongibson
Copy link
Owner

Moving to #1432

@niksite
Copy link

niksite commented Sep 6, 2022

The ordering parameter is also included in the schema twice for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants