Contributions
"readOnly" and "required" C# properties generation
Dears Please help me with readOnly property generation I've found that properties declared with readOnly -oneOf are generated with Object data type. Customer: type: object required: - "ClientTypeId" properties: ClientTypeId: type: "integer" format: "int32" ClientType: readOnly: true allOf: - $ref: '#/definitions/ClientType' definitions: ClientType: type: object required: - "ClientTypeId" properties: ClientTypeId: type: "integer" format: "int32" Description: type: "string" LegalType: type: "boolean" ClientType is generated as /// <summary> /// Gets or Sets ClientType /// </summary> [DataMember(Name="ClientType")] public Object ClientType { get; set; } however I expected that it will get strongly typed property ClientType according to the definition additionally ClientTypeId is generated as Nullable<int> property but I expect that it will be generated like int ClientTypeId: /// <summary> /// Gets or Sets ClientTypeId /// </summary> [Required] [DataMember(Name="ClientTypeId")] public int? ClientTypeId { get; set; } I used both online generatorhttps://generator.swagger.io/api/gen/servers/aspnetcore and offline swagger-codegen (https://github.com/swagger-api/swagger-codegen) at master. Is it possible to get ClientType to be generated as public ClientType ClientType { get; set; } ? Regards2.2KViews0likes1CommentApiClient ApiException Configuration namespaces do not match to packageName option
Dears I'm trying to generate csharp client form petstore json OpenAPI with packageName parameter specified However the problem is that not all generated files has packageName value from config. Files ApiClient.cs ApiException.cs Configuration.cs are generated with default IO.Swagger.Client namespace. This is not correct I suppose and Api\*.cs and Model\*.cs source code files are generated with custom namespace (This is correct) I use curl command like below to generate client source code (it has to be executed using bash) curl -H "Content-type: application/json" -X POST -d '{"options": {"packageName": "pet_store"},"swaggerUrl": "http://petstore.swagger.io/v2/swagger.json"}' https://generator.swagger.io/api/gen/clients/csharp-dotnet2 Then I download archive using url from output (https://generator.swagger.io/api/gen/download/bf95a63d-5be5-4f46-89fc-720ab2a692f7) The problem is thatApiClient.cs ApiException.cs and Configuration.cs files are generated with default IO.Swagger.Client namespace however I expect that namespace value have to be set to pet_store according to parameterization. I replace namespace manually in the generated files however it would be nice to have namespace generated as it was parameterized. When offlineswagger-codegen is used with config file it generates namepace in the same way java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i https://petstore.swagger.io/v2/swagger.json -l csharp-dotnet2 -o D:\temp\cw -c D:\temp\cw\config.json config.json: { "packageName" : "petT_store" } Is there any other option to set namespace for all generated files?1.9KViews0likes2Comments