OpenAPI.NET icon indicating copy to clipboard operation
OpenAPI.NET copied to clipboard

Provide IOpenApiSchema interface

Open petriashev opened this issue 4 years ago • 2 comments

I am a supporter of MicroElements.Swashbuckle.FluentValidation project and I want to support NJsonSchema (NSwag).

Issue: https://github.com/micro-elements/MicroElements.Swashbuckle.FluentValidation/issues/63 One of the possible solutions is to adapt NJsonSchema to OpenApiSchema but it is a concrete type.

Can we extract IOpenApiSchema interface?

petriashev avatar Jan 10 '21 15:01 petriashev

We will probably have to make some changes to the OpenApiSchema model as we implement OpenAPI 3.1 support and support for JSON Schema 2020-12 draft. We can consider an interface then.

Wouldn't it just be easier to create a factory that creates an OpenAPISchema from an NJsonSchema parameter?

darrelmiller avatar Jan 10 '21 22:01 darrelmiller

Wouldn't it just be easier to create a factory that creates an OpenAPISchema from an NJsonSchema parameter?

Yes it is another option. This case I need convert NJsonSchema -> OpenAPISchema and back. At this moment I think more easy is to create some schema adapter with functionality I need. But I don't want to create Yet Another Interface That Common to other existing :)

Third option is to support two branches for OpenApi and NJsonSchema separately.

petriashev avatar Jan 11 '21 07:01 petriashev