Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Added support for media types in query parameters #238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Graz21
Copy link

@Graz21 Graz21 commented Apr 13, 2021

This project really helped us out generating OpenAPI 3.0 schemas for out .Net Framework WebAPI.

In our WebAPI some of the controllers have actions that can have complex types as query parameters and we wanted the possibility of describing those parameters as content, instead of schema.

For example:

"parameters": [
    {
      "name": "queryString",
      "in": "query",
      "description": "Query param 1 with no media type",
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "sampleObjectInQuery2",
      "in": "query",
      "description": "Query param as application/json content",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Microsoft.OpenApi.CSharpAnnotations.DocumentGeneration.Tests.Contracts.SampleObject1"
          }
        }
      }
    }
]

Changes introduced:

  • Query parameters can have type specified (similar to body parameters)
  • If no type is specified describes the parameter as schema (maintains the default behaviour)
  • Added a new controller to test default and new behaviour
  • Added a test in GetTestCasesForValidDocumentationShouldReturnCorrectDocument

@ghost
Copy link

ghost commented Apr 13, 2021

CLA assistant check
All CLA requirements met.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant