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

Implement parameter serialization according to the OpenAPI 3 specification #89

Closed
timgrohmann opened this issue Mar 27, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@timgrohmann
Copy link

Using the a schema inside query params results in incorrect serialization.

The following path contains a query parameter named Coordinates that is defined by the schema Coordinates (a struct containing numerical values for longitude and latitude). According to the OpenAPI-Specification, query parameters should be serialized.

'/locations':
    get:
      tags:
        - Locations
      operationId: searchLocations
      description: |
        Searches for locations in the given range.
      parameters:
        - in: query
          name: Coordinates
          required: true
          explode: true
          schema:
            $ref: '#/components/schemas/Coordinates'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Location'
                maxItems: 100

Expected behavior

Generating this path and calling it from angular should result in a call to .../locations?longitude=51.412&latitude=12.4386.

Actual behavior

Generating this path and calling it from angular results in a call to .../locations?Coordinates=[object Object].

I'd be glad to help out if you could point me to where exactly this bug would need to be fixed.

@luisfpg luisfpg added the bug Something isn't working label Mar 27, 2020
@luisfpg
Copy link
Contributor

luisfpg commented Mar 27, 2020

There is currently no support for parameter serialization.
However, I'm already working on it.

@luisfpg luisfpg added enhancement New feature or request and removed bug Something isn't working labels Mar 27, 2020
@luisfpg luisfpg changed the title Query Parameters are not serialized correctly Implement parameter serialization according to the OpenAPI 3 specification Mar 27, 2020
@luisfpg
Copy link
Contributor

luisfpg commented Mar 27, 2020

I've actually implemented all serialization cases described in https://swagger.io/docs/specification/serialization/.

@timgrohmann Can you, please, test with the latest master version and see if it works as expected?
See https://github.com/cyclosproject/ng-openapi-gen#developing-and-contributing

@timgrohmann
Copy link
Author

@luisfpg Thank you so much for the quick fix! It's working now.

luisfpg added a commit that referenced this issue Mar 30, 2020
Was introduced with the fix to #89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants