Skip to content

OpenApi inline enum for query parameters #57979

@dnv-kimbell

Description

@dnv-kimbell

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have an operation with that takes in an enum as query string parameter, and returns it back in the response.

In the parameter section, the enum is just defined as string with no information about what valid values are

"parameters": [
	{
		"name": "e",
		"in": "query",
		"schema": {
			"type": "string"
		}
	}
],

In the response the enum is referenced and it's possible to figure out valid values

"responses": {
	"200": {
		"description": "OK",
		"content": {
			"application/json": {
				"schema": {
					"$ref": "#/components/schemas/EnumWithNoFlags"
				}
			}
		}
	}
}

Expected Behavior

The query parameter should use a reference to the enum schema.

Steps To Reproduce

https://github.com/dnv-kimbell/openapi-inlineschema

Exceptions (if any)

No response

.NET Version

9.0 RC1

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesfeature-openapi

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions