[C#] Missing Models for Map types and incomplete types for Api Endpoints
Created by: etherealjoy
Description
With the following valid spec
-
The map models are not generated and the Api is having a wrong type for the response associated with map.
-
When a map is part of an object the model is generated correctly with the map inside the object. When a model type is a map, there is incorrect generation of code either as an inline model or as a map when referred from another model.
-
General issues with inline models always being reported as objects
openapi-generator version
3.0.0
OpenAPI declaration file content or url
---
# This is a sample Swagger spec
swagger: "2.0"
info:
description: Application Description
version: 1.0.0
title: Application
host: 0.0.0.0:8080
basePath: /api/v1.0
schemes:
- http
tags:
- name: ApplicationResources
x-displayName: "ApplicationResources"
description: |
"Application Resources."
- name : ApplicationLifeCycle
x-displayName : "ApplicationLifeCycle"
description : |
"Application Lifecycle."
- name: ApplicationTestConfiguration
x-displayName : "ApplicationTestConfiguration"
description : |
"Application Test Configuration"
- name: ApplicationEndpointTest
x-displayName: "ApplicationEndpointTest"
description: |
"Application Endpoint Test"
paths:
/default/Resources/{id}:
post:
tags:
- ApplicationResources
operationId: resourceStatusSet
consumes:
- application/json
produces:
- application/json
parameters:
- name: "exclusive"
in: "query"
type: "boolean"
default: false
- name: id
in: "path"
required: true
type: integer
format: int32
- name: "body"
in: "body"
schema:
$ref: "#/definitions/ResourceRequest"
responses:
200:
description: ""
schema:
$ref: "#/definitions/ResourceOperationsStatus"
404:
description: ""
schema:
$ref: "#/definitions/ErrorSts"
get:
tags:
- ApplicationResources
operationId: resourceStatusGet
produces:
- application/json
parameters:
- name: id
in: path
description: "Id of the Resource"
required: true
type: integer
format: int32
responses:
200:
description: ""
schema:
$ref: "#/definitions/Resource"
404:
description: ""
schema:
$ref: "#/definitions/ErrorSts"
/default/ApiTestSetup:
post:
tags:
- ApplicationTestConfiguration
operationId : apiTestConfigurationSet
consumes:
- application/json
parameters :
- name : "body"
in : "body"
required: true
schema:
$ref: "#/definitions/TestEndPointConfig"
responses:
200:
description: "Successful response"
400:
description: "The request was not successfully executed."
get:
tags:
- ApplicationTestConfiguration
operationId: apiTestConfigurationGet
produces:
- application/json
responses:
200:
description: "Successful response"
schema:
$ref: "#/definitions/TestEndPointConfig"
400:
description: "The request was not successfully executed."
definitions:
Options:
type: "object"
properties:
Config:
type: "object"
additionalProperties:
type: "string"
Resource:
required:
- id
type: object
properties:
id:
type: integer
format: int32
name:
type: string
type:
type: string
options:
$ref: "#/definitions/Options"
ResourceOperations:
type: "object"
additionalProperties:
type: "string"
ResourceOperationsStatus:
type: "object"
additionalProperties:
type: "string"
ResourceRequest:
allOf:
- $ref: "#/definitions/Resource"
- type: "object"
required:
- handle
properties:
handle:
type : "string"
x-nullable: false
requestCode:
type: integer
format: int32
operations:
$ref: "#/definitions/ResourceOperations"
payload:
type: array
items:
type: integer
format: int32
args:
type: "array"
items:
type: "string"
ErrorSts:
required:
- code
type : object
properties:
code:
type: integer
format: int32
message:
type: string
TestEndPointConfig :
type : "object"
additionalProperties :
type: "string"
Command line used for generation
java -jar ~/dev/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i ./Cta.yaml -o ./genserver -l aspnetcore --additional-properties packageName=Cta
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Is the Map support broken in C#