Bug Report Checklist
Description
In the file modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache the IValidatableObject interface is implemented when required, but purposefully hidden. The models get generated with the interface, and the code, but as it's set to private it can't be used.
(Note: The issue can be easily be fixed locally with a custom template. This issue is mostly to understand how this happened, and if there is a purpose to it.)
openapi-generator version
5.2.1
OpenAPI declaration file content or url
Snippet schema of a model that has this issue:
components:
schemas:
ClockRate:
type: integer
format: int
description: clock rate
example: 90000
default: 90000
NewStreamRequest:
type: object
properties:
clockRate:
$ref: '#/components/schemas/ClockRate'
Generation Details
Was encountered using the csharp-netcore generator, and the latest-release docker image.
Steps to reproduce
Using a yaml file that contains a model what can be validated
docker run --rm -v %cd%:/local openapitools/openapi-generator-cli:latest-release generate ^
-i /local/openapi.yaml ^
-g csharp-netcore ^
-o /local/output/openapi
Related issues/PRs
Suggest a fix
In the file modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache change line 399 and 418 from
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
to
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
Bug Report Checklist
Description
In the file modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache the IValidatableObject interface is implemented when required, but purposefully hidden. The models get generated with the interface, and the code, but as it's set to private it can't be used.
(Note: The issue can be easily be fixed locally with a custom template. This issue is mostly to understand how this happened, and if there is a purpose to it.)
openapi-generator version
5.2.1
OpenAPI declaration file content or url
Snippet schema of a model that has this issue:
Generation Details
Was encountered using the csharp-netcore generator, and the latest-release docker image.
Steps to reproduce
Using a yaml file that contains a model what can be validated
Related issues/PRs
Suggest a fix
In the file modules/openapi-generator/src/main/resources/csharp-netcore/modelGeneric.mustache change line 399 and 418 from
to