Skip to content

[BUG] Support for deepObject for query parameters #320

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

Closed
alextarrago opened this issue Jan 23, 2022 · 6 comments
Closed

[BUG] Support for deepObject for query parameters #320

alextarrago opened this issue Jan 23, 2022 · 6 comments
Assignees
Labels
bug Something isn't working waiting customer response

Comments

@alextarrago
Copy link

Support for deepObject notation for query parameters.

This spec does not generate the expected behaviour.

/service-categories:
    get:
      operationId: listCategories
      tags:
        - ServiceCategories
      parameters:
        - $ref: '#/components/parameters/ServiceCategoryCriteria'
ServiceCategoryCriteria:
      type: object
      properties:
        parentId:
          $ref: '#/components/schemas/LongFilter'
        onlyServicesActive:
          type: boolean
          default: false
        enabled:
          $ref: '#/components/schemas/BooleanFilter'

Intercepting the parameters in the client interceptor gives us the following code:

{q: Instance of 'ServiceCategoryCriteria'}

Some guidance on here? :)

@Vovanella95
Copy link
Collaborator

Hi @alextarrago

Actually, your swagger file is not valid. Referenced parameters should be parameter, not just model. I mean parameters should have "in", "required" field and should NOT have properties. If you put such parameter into swagger editor you will have next error:

Structural error at components.parameters.ServiceCategoryCriteria should NOT have additional properties additionalProperty: type, properties

Please, share valid yaml code.
https://i.postimg.cc/9frt4Xhq/Screenshot-2022-01-25-at-15-40-48.png

Also, I can fix you swagger, for example, in a next way:
https://i.postimg.cc/3wx7m6SG/Screenshot-2022-01-25-at-15-43-20.png

Everything is clear here? Am I understand you problem correctly?

@alextarrago
Copy link
Author

Hi @Vovanella95, thanks for the fast reply!
How can I share the yaml file to you, privately?

Thanks.

@Vovanella95
Copy link
Collaborator

@alextarrago sure, [email protected]

@Vovanella95
Copy link
Collaborator

Vovanella95 commented Jan 25, 2022

@alextarrago OK I have generated your example. I have request with parameter ServiceCategoryCriteria. What is the issue? I can't understand what is wrong

/service/categories method is generated, it has parameter named q and type ServiceCategoryCriteria

@Vovanella95
Copy link
Collaborator

@alextarrago closing the issue due to no response. Please reopen it if it actual

@calebdeji
Copy link

calebdeji commented Jan 30, 2025

Hi @Vovanella95 ,

similar to this OAI/OpenAPI-Specification#1706,

parameters:
        - name: filter
          in: query
          schema:
            type: object
          style: deepObject
          explode: true
          description: Filter by category ID

The query param generated from this

_cmsRemoteDataSource.subCategoriesGet(
          filter: {r'[category][id][$eq]': 25},
        )

is filter.[category][id][$eq]=25, the dot (.) before [category] shouldn't be there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting customer response
Projects
None yet
Development

No branches or pull requests

4 participants