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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Deserialize custom types with inline schemas #823

Merged

Conversation

duncanbeevers
Copy link
Contributor

@duncanbeevers duncanbeevers commented Mar 4, 2023

馃惛 Problem to be solved

Inline schemas for custom formats in path parameters are not deserialized.

The following simple schema demonstrates the behavior:

  • 馃 date-in-components is deserialized to a Date object
  • 鈿狅笍 date-inline is not deserialized to a Date object
paths:
  /users
    get:
      parameters:
        - name: date-in-components
          in: query
          schema:
            $ref: '#/components/schemas/DateTime'
        - name: date-inline
          in: query
          schema:
            type: string
            format: date-time
components:
  schemas:
    DateTime:
      type: string
      format: date-time

馃憫 Proposed solution

Gather path parameter custom-format schemas and augment them in the same way component schemas are.

馃敡 Changes

  • serdes.spec app emits summary objects as part of its GET and POST responses
  • Type checks are made against response bodies (as well as existing checks in the endpoint handlers)
  • query parameters declared with inline custom format schemas are deserialized to their expected custom types

@cdimascio cdimascio merged commit d53621d into cdimascio:master Apr 30, 2023
@duncanbeevers duncanbeevers deleted the deserialize-inline-custom-schemas branch April 30, 2023 21:04
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

Successfully merging this pull request may close these issues.

None yet

2 participants