[BUG] aspnetcore generator optional string query param dataType `string` instead of `string?`
Created by: gbmarc1
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
The dataType of the function signature should be string?
and not string
for the uuid
parameter.
Note that the offset
parameter (integer) is generated properly with the ?
.
Actual output:
public abstract IActionResult ApisV1ProjectsProjectIdWorkUnitDataGet([FromRoute (Name = "projectId")][Required]int projectId, [FromQuery (Name = "offset")]int? offset, [FromQuery (Name = "uuid")][RegularExpression("^([0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12})$")]string uuid);
Expected output:
public abstract IActionResult ApisV1ProjectsProjectIdWorkUnitDataGet([FromRoute (Name = "projectId")][Required]int projectId, [FromQuery (Name = "offset")]int? offset, [FromQuery (Name = "uuid")][RegularExpression("^([0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12})$")]string? uuid);
openapi-generator version
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: API
version: 0.0.0
servers:
- url: /_apis/v1/
security:
- basicAuth: []
tags:
- description: Work-unit data
name: work-unit data
paths:
/projects/{projectId}/workUnitData:
get:
summary: Get work-unit data
tags:
- work-unit data
operationId: _apis.v1.projects.projectId.workUnitData.get
parameters:
- $ref: '#/components/parameters/projectId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/uuid'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/WorkUnitData'
description: Confirmation of project registration
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: '`projectId` not found.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
parameters:
uuid:
description: UUID of working list
in: query
explode: true
name: uuid
required: false
schema:
pattern: "^([0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12})$"
type: string
style: form
offset:
description: Offset for paging
explode: true
in: query
name: offset
required: false
schema:
minimum: 0
type: integer
style: form
limit:
description: Limit for paging
explode: true
in: query
name: limit
required: false
schema:
minimum: 0
type: integer
style: form
workUnitDatumId:
description: Work-unit datum identifier
in: path
name: workUnitDatumId
required: true
schema:
minimum: 1
type: integer
projectId:
description: Project identifier
in: path
name: projectId
required: true
schema:
minimum: 1
type: integer
schemas:
WorkUnitData:
additionalProperties: false
example:
total: 100
count: 1
items:
- workUnitDatumId: 1
workUnitId: 1
sentence: I love my teacher
comment: I love my teacher. I also love my TA.
jobTypeName: eec
jobTypeVersion: 0.0.0
- workUnitDatumId: 2
workUnitId: 1
sentence: I love my teacher
comment: I love my teacher. I also love my TA.
jobTypeName: eec
jobTypeVersion: 0.0.0
properties:
count:
description: Number of records in the current page
example: 1
minimum: 0
readOnly: true
type: integer
total:
description: Total number of records accross all pages
example: 100
minimum: 0
readOnly: true
type: integer
items:
items:
$ref: '#/components/schemas/WorkUnitDatum'
readOnly: true
type: array
_links:
$ref: '#/components/schemas/PageLinks'
required:
- count
- items
- total
- _links
type: object
WorkUnitDatum:
additionalProperties: false
example:
workUnitDatumId: 1
workUnitId: 1
sentence: I love my teacher
comment: I love my teacher. I also love my TA.
jobTypeName: eec
jobTypeVersion: 0.0.0
properties:
workUnitDatumId:
description: Identifier of the work-unit datum
readOnly: true
type: integer
minimum: 1
workUnitId:
description: Identifier of the work-unit
readOnly: true
type: integer
minimum: 1
sentence:
description: Sentence of a comment
readOnly: true
type: string
comment:
description: Comment
readOnly: true
type: string
jobTypeName:
description: Jobtype name associated to work-unit
readOnly: true
type: string
jobTypeVersion:
description: Jobtype version associated to work-unit
readOnly: true
type: string
pattern: ^[0-9]+\.[0-9]+\.[0-9]+$
required:
- workUnitDatumId
- workUnitId
- comment
- projectId
type: object
PageLinks:
type: object
properties:
self:
type: string
readOnly: true
description: Opaque link to the current page
prev:
type: string
readOnly: true
description: Opaque link to the previous page
next:
type: string
readOnly: true
description: Opaque link to the next page
additionalProperties: false
required:
- self
Error:
additionalProperties: false
properties:
type:
description: A URI reference that identifies the problem type.
readOnly: true
type: string
title:
description: 'A short, human-readable summary of the problem type.'
readOnly: true
type: string
status:
description: The HTTP status code.
readOnly: true
type: integer
detail:
description: A human-readable explanation specific to this occurrence of the problem.
readOnly: true
type: string
instance:
description: A URI reference that identifies the specific occurrence of the problem.
readOnly: true
type: string
timestamp:
description: Timestamp of the error.
format: date-time
readOnly: true
type: string
required:
- status
- timestamp
- title
- type
type: object
securitySchemes:
basicAuth:
scheme: basic
type: http
Generation Details
openapi-generator-cli 5.1.1-SNAPSHOT
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate -i local/openapi/openapi.yaml -g aspnetcore -o local/WorkflowApiOpenApi -p aspnetCoreVersion=5.0 -p packageVersion=0.0.0 -p isLibrary=true -p packageName=WorkflowApiOpenApi --config local/openapi/config.yaml -p operationModifier=abstract -p classModifier=abstract
Steps to reproduce
Generate with above command
Related issues/PRs
#9234
Suggest a fix
Good datatype.