Skip to content

OpenAPI v2 is not read properly when Produces/Consumes is not provided #842

Closed

Description

@darrelmiller

Related: #706

The OpenAPI v2 specification is not clear that Produces/Consumes are required to be able to completely describe an API request/response.

This means that when OpenAPI v2 documents are read in, if they don't have a produces/consumes then there is no media type object created and there is nowhere to put any schema that has been specified.

By adding a defaultContentType property to the OpenApiReaderSettings object we can use that to create a content object if there is no produces/consumes and we will not lose the schema information. This will not change the default behavior of library.

Activity

  1. added
    type:enhancementEnhancement request targeting an existing experience
    priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days
    and removed on May 5, 2022
  2. darrelmiller commented on Jul 4, 2022

    @darrelmiller
    MemberAuthor

    It turns out we already have code that assumes application/json for a body or application/x-url-encoded-form for form data. The only thing that was missing was a check for an empty consumes/produces array. Considering this feature only causes issues for V2 I am reluctant to add another reader setting unless we have customers asking for it.

  3. added this to the NET:1.4 milestone on Jul 4, 2022
  4. MaggieKimani1 commented on Jul 6, 2022

    @MaggieKimani1
    Contributor

    I concur on not adding a new reader setting if we can retain the schema info by adding the missing check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7daystype:enhancementEnhancement request targeting an existing experience

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions