FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Added support for media types in query parameters by Graz21 · Pull Request #238 · microsoft/OpenAPI.NET.CSharpAnnotations · GitHub

This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Added support for media types in query parameters - #238

Open
Gonçalo Grazina (Graz21) wants to merge 1 commit into
microsoft:masterfrom
Graz21:AddSupportForMediaTypesInQueryParams
Open

Added support for media types in query parameters#238
Gonçalo Grazina (Graz21) wants to merge 1 commit into
microsoft:masterfrom
Graz21:AddSupportForMediaTypesInQueryParams

Conversation

Gonçalo Grazina (Graz21) commented Apr 13, 2021
edited
Loading

Copy link
Copy Markdown

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

Deleted user (ghost) commented Apr 13, 2021
edited by ghost
Loading

Copy link
Copy Markdown


All CLA requirements met.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL