You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per title, I am trying to generate the model classes for the docker api swagger spec, this contains a number of nullable properties of format "integer" and format "int64". They are being generated as long? but then given a default value which indicates it is a float, e.g. long? size = -1F which causes a compiler error.
Swagger-codegen version
3.0.65
Swagger declaration file content or url
UsageData:
type: "object"x-nullable: truex-go-name: "UsageData"required: [Size]description: | Usage details about the volume. This information is used by the `GET /system/df` endpoint, and omitted in other endpoints.properties:
Size:
type: "integer"format: "int64"default: -1description: | Amount of disk space used by the volume (in bytes). This information is only available for volumes created with the `"local"` volume driver. For volumes created with other volume drivers, this field is set to `-1` ("not available")x-nullable: false
produces
/// <summary>/// Initializes a new instance of the <see cref="VolumeUsageData" /> class./// </summary>/// <param name="size">Amount of disk space used by the volume (in bytes). This information is only available for volumes created with the `\"local\"` volume driver. For volumes created with other volume drivers, this field is set to `-1` (\"not available\") (required) (default to -1F).</param>publicVolumeUsageData(long? size =-1F)
Observe all the default float values being given for longs when you try to build it.
Related issues/PRs
None found
Suggest a fix/enhancement
Feels like somewhere along the way nullable int64 types are being treated as floats somewhere between the correct mapping into an actual C# type (a long?) and working out what default value to use.
The text was updated successfully, but these errors were encountered:
Description
As per title, I am trying to generate the model classes for the docker api swagger spec, this contains a number of nullable properties of format "integer" and format "int64". They are being generated as
long?
but then given a default value which indicates it is a float, e.g.long? size = -1F
which causes a compiler error.Swagger-codegen version
3.0.65
Swagger declaration file content or url
produces
Command line used for generation
docker run --rm --network=host -v ${PWD}:/local swaggerapi/swagger-codegen-cli-v3 generate \ -i http://localhost:3000/swagger.yaml \ -l csharp \ -Dmodels \ --additional-properties=resolveMethodConflicts=true \ -c /local/config.json \ -o /local/out/csharp
Steps to reproduce
Using the following docker swagger spec (which originally came from here)
swagger.yaml.zip
Host the swagger-ui mounting this spec file in
docker run -p 3000:8080 -e SWAGGER_JSON=/swagger.yaml -v $(pwd)/swagger.yaml:/swagger.yaml swaggerapi/swagger-ui
docker run --rm --network=host -v ${PWD}:/local swaggerapi/swagger-codegen-cli-v3 generate \ -i http://localhost:3000/swagger.yaml \ -l csharp \ -Dmodels \ --additional-properties=resolveMethodConflicts=true \ -c /local/config.json \ -o /local/out/csharp
Related issues/PRs
None found
Suggest a fix/enhancement
Feels like somewhere along the way nullable int64 types are being treated as floats somewhere between the correct mapping into an actual C# type (a
long?
) and working out what default value to use.The text was updated successfully, but these errors were encountered: