Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use custom C# DataAnnotation attributes on NSwag DTO Objects based on Data Type format #3246

Closed
csehatt741 opened this issue Jan 13, 2021 · 1 comment

Comments

@csehatt741
Copy link

Is it possible to generate custom DataAnnotations on DTO object based on Data Type format?

"Country": {
"type": "string",
"format": "country",
"description": "Country"
}

It seems JsonSchemaProperty.ActualSchema.Format could be used in Class.Property.Annotations.liquid, but JsonSchemaProperty is a private field of PropertyModel.

@csehatt741 csehatt741 changed the title Use custom C# attributes on NSwag DTO Objects based on Data Type format Use custom C# DataAnnotation attributes on NSwag DTO Objects based on Data Type format Jan 13, 2021
RicoSuter added a commit to RicoSuter/NJsonSchema that referenced this issue Jan 14, 2021
@RicoSuter
Copy link
Owner

Added the property to the model so you can use it in the custom template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants