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 на генерации схемы #186

Open
stepan-fedorovv opened this issue May 20, 2024 · 0 comments

Comments

@stepan-fedorovv
Copy link

https://github.com/best-doctor/restdoctor/blob/master/restdoctor/rest_framework/schema/filters.py#L77

FILTER_MAP: FilterMap = {
    BooleanFilter: {'type': 'boolean'},
    ChoiceFilter: _get_filter_schema_choice,
    MultipleChoiceFilter: _get_filter_schema_choice,
    TypedChoiceFilter: _get_filter_schema_choice,
    TypedMultipleChoiceFilter: _get_filter_schema_choice,
    DateFilter: functools.partial(_get_filter_schema_datetime, schema_format='date'),
    DateFromToRangeFilter: functools.partial(_get_filter_schema_datetime, schema_format='date'),
    DateTimeFilter: functools.partial(_get_filter_schema_datetime, schema_format='date-time'),
    DateTimeFromToRangeFilter: functools.partial(
        _get_filter_schema_datetime, schema_format='date-time'
    ),
    NumberFilter: {'type': 'number'},
    TimeFilter: functools.partial(_get_filter_schema_datetime, schema_format='time'),
    ModelChoiceFilter: {'type': 'string'},
    ModelMultipleChoiceFilter: {'type': 'string'},
}

python 3.12, restdoctor 0.0.64

схема генерируется с ошибками при создании кастомного OrderingFilter

      - name: ordering
        required: false
        in: query
        description: !!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
          enum:
          - ''
          - start_time
          - -start_time
          - members
          - -members

атрибут description выдает ошибку при сборке через шаблон swagger

manage: python ./manage.py generateschema --urlconf configuration.urls --generator_class restdoctor.rest_framework.schema.RefsSchemaGenerator > apps/user/static/static_docs/api/openapi.schema

swagger error:

Parser error on line 373
unknown tag !<tag:yaml.org,2002:python/name:django.utils.translation.gettext>
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

1 participant