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

Properly deserialize ref requestBodies in v2 #932

Closed
millicentachieng opened this issue Jul 6, 2022 · 5 comments
Closed

Properly deserialize ref requestBodies in v2 #932

millicentachieng opened this issue Jul 6, 2022 · 5 comments
Assignees
Labels
priority:p2 Medium. Generally has a work-around and a smaller sub-set of customers is affected. SLA <=30 days type:bug A broken experience
Milestone

Comments

@millicentachieng
Copy link
Member

millicentachieng commented Jul 6, 2022

Below is what the current serialization yields:

# omitted
paths:
  '/Documents({Id})/Revisions/$ref'
      post:
            tags:
              - Documents.RevisionDto
            summary: Create new navigation property ref to Revisions for Documents
            operationId: Documents.CreateRefRevisions
            consumes: [ ]
            parameters:
              - in: path
                name: Id
                description: 'key: Id of DocumentDto'
                required: true
                type: integer
                format: int32
                maximum: 2147483647
                minimum: -2147483648
                x-ms-docs-key-type: DocumentDto
              - in: body
                name: body
                schema: { }
            responses:
              '204':
                description: Success
              default:
                $ref: '#/responses/error'
            x-ms-docs-operation-type: operation
definitions:
  ReferenceCreate:
      type: object
      properties:
        '@odata.id':
          type: string
      additionalProperties:
        type: object
  

Expected result:

# omitted
paths:
  '/Documents({Id})/Revisions/$ref'
      post:
            tags:
              - Documents.RevisionDto
            summary: Create new navigation property ref to Revisions for Documents
            operationId: Documents.CreateRefRevisions
            consumes: 
              - application/json
            parameters:
              - in: path
                name: Id
                description: 'key: Id of DocumentDto'
                required: true
                type: integer
                format: int32
                maximum: 2147483647
                minimum: -2147483648
                x-ms-docs-key-type: DocumentDto
              - $ref: '#/parameters/refPostBody'
            responses:
              '204':
                description: Success
              default:
                $ref: '#/responses/error'
            x-ms-docs-operation-type: operation
parameters:
    refPostBody:
        in: body
        name: body
        description: New navigation property ref value
        required: true
        schema:
          $ref: '#/definitions/ReferenceCreate'
@millicentachieng millicentachieng changed the title Properly handle ref requestBodies Properly deserialize ref requestBodies in v2 Jul 6, 2022
@baywet baywet added type:bug A broken experience priority:p2 Medium. Generally has a work-around and a smaller sub-set of customers is affected. SLA <=30 days labels Jul 6, 2022
@baywet baywet added this to the NET:1.3 milestone Jul 6, 2022
@darrelmiller
Copy link
Member

darrelmiller commented Jul 6, 2022

requestBodies is not a valid property of a OpenAPI 2.0 document https://spec.openapis.org/oas/v2.0.html#fixed-fields

The expected result as shown above is not correct.

The problem with the original document is the most likely related to the empty consumes array. This is a bug that I fixed yesterday #926

@millicentachieng
Copy link
Member Author

@darrelmiller, thank you for pointing that out. I'll be testing with your changes and then report back.

@CarolKigoonya CarolKigoonya modified the milestones: NET:1.3, NET:1.4 Jul 12, 2022
@darrelmiller
Copy link
Member

@millicentachieng Can we close this?

@millicentachieng
Copy link
Member Author

@millicentachieng Can we close this?
Yes. Closing...

@millicentachieng
Copy link
Member Author

Related #1033

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p2 Medium. Generally has a work-around and a smaller sub-set of customers is affected. SLA <=30 days type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

4 participants