OpenAPITools / OpenAPITools/openapi-generator
[BUG][C#] Enums are not generated for embedded enums
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Using c# net core
json such as:
"/deployment": {
"get": {
"operationId": "getDeployments",
"tags": [
"Deployment"
],
"summary": "Get List",
"description": "Queries for deployments that fulfill given parameters. Parameters may be the properties of deployments,\nsuch as the id or name or a range of the deployment time. The size of the result set can be retrieved by\nusing the [Get Deployment count](https://docs.camunda.org/manual/latest/reference/rest/deployment/get-query-count/) method.",
"parameters": [
{
"name": "id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter by deployment id"
},
{
"name": "name",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter by the deployment name. Exact match."
},
{
"name": "nameLike",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter by the deployment name that the parameter is a substring of. The parameter can include the\nwildcard `%` to express like-strategy such as: starts with (`%`name), ends with (name`%`) or contains\n(`%`name`%`)."
},
{
"name": "source",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter by the deployment source."
},
{
"name": "withoutSource",
"in": "query",
"schema": {
"default": false,
"type": "boolean"
},
"description": "Filter by the deployment source whereby source is equal to `null`."
},
{
"name": "tenantIdIn",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter by a comma-separated list of tenant ids. A deployment must have one of the given tenant ids."
},
{
"name": "withoutTenantId",
"in": "query",
"schema": {
"default": false,
"type": "boolean"
},
"description": "Only include deployments which belong to no tenant. Value may only be `true`, as `false` is the default\nbehavior."
},
{
"name": "includeDeploymentsWithoutTenantId",
"in": "query",
"schema": {
"default": false,
"type": "boolean"
},
"description": "Include deployments which belong to no tenant. Can be used in combination with `tenantIdIn`. Value may\nonly be `true`, as `false` is the default behavior."
},
{
"name": "after",
"in": "query",
"schema": {
"type": "string",
"format": "date-time"
},
"description": "Restricts to all deployments after the given date.\nBy [default](https://docs.camunda.org/manual/latest/reference/rest/overview/date-format/), the date must have the format\n`yyyy-MM-dd\u0027T\u0027HH:mm:ss.SSSZ`, e.g., `2013-01-23T14:42:45.000+0200`."
},
{
"name": "before",
"in": "query",
"schema": {
"type": "string",
"format": "date-time"
},
"description": "Restricts to all deployments before the given date.\nBy [default](https://docs.camunda.org/manual/latest/reference/rest/overview/date-format/), the date must have the format\n`yyyy-MM-dd\u0027T\u0027HH:mm:ss.SSSZ`, e.g., `2013-01-23T14:42:45.000+0200`."
},
{
"name": "sortBy",
"in": "query",
"schema": {
"enum": [
"id",
"name",
"deploymentTime",
"tenantId"
],
"type": "string"
},
"description": "Sort the results lexicographically by a given criterion.\nMust be used in conjunction with the sortOrder parameter."
},
{
"name": "sortOrder",
"in": "query",
"schema": {
"enum": [
"asc",
"desc"
],
"type": "string"
},
"description": "Sort the results in a given order. Values may be asc for ascending order or desc for descending order.\nMust be used in conjunction with the sortBy parameter."
},
{
"name": "firstResult",
"in": "query",
"schema": {
"type": "integer"
},
"description": "Pagination of results. Specifies the index of the first result to return."
},
{
"name": "maxResults",
"in": "query",
"schema": {
"type": "integer"
},
"description": "Pagination of results. Specifies the maximum number of results to return.\nWill return less results if there are no more results left."
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DeploymentDto"
}
},
"examples": {
"example-1": {
"summary": "GET `/deployment?name\u003ddeploymentName`",
"value": [
{
"id": "someId",
"name": "deploymentName",
"source": "process application",
"tenantId": null,
"deploymentTime": "2013-04-23T13:42:43.000+0200"
}
]
}
}
}
},
"description": "Request successful."
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExceptionDto"
}
}
},
"description": "Returned if some of the query parameters are invalid, for example if a `sortOrder` parameter is supplied,\nbut no `sortBy`, or if an invalid operator for variable comparison is used. See the\n[Introduction](https://docs.camunda.org/manual/latest/reference/rest/overview/#error-handling)\nfor the error response format."
}
}
}
}
The SortBy enum does not get generated as a C# enum.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the C# generator against the embedded OpenAPI example, focusing on the inline enum used by the sortBy parameter. Inspect the generated client output and the generator's handling of embedded enums; done means SortBy is emitted as a C# enum rather than being omitted or represented only as a string.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100