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

Relative server url - V3

Open talamram opened this issue 7 years ago • 4 comments

Hi, Not sure if it is supported right now, but when having a relative url in the description file (V3), and of course setting up a BaseUrl in the OpenApiReaderSettings, a full server path is not generated. In V2, when giving only basePath (without host), a full server url is generated correctly.

Thanks

talamram avatar Aug 07 '18 08:08 talamram

Hmm. Will investigate. I thought this was resolved.

darrelmiller avatar Aug 11 '18 14:08 darrelmiller

@talamram The current behavior is by design. But it may have been a mistake on my part. For V3 documents, being able to roundtrip from serialized form to model and back to serialized form is very important. If we resolve references using the base URL then we lose the fact that the input document used a relative reference. We have no such round-tripping commitments for V2 documents, so updating the server URL is fine.

We could just hold the BaseUrl as a property on the OpenApiDocument and then provide a utility method for resolving references. However, that won't help for resolving references in fragments. We could add a BaseUrl property to every object that has a property that could be a relative reference. However, that feels like a sledge hammer solution.

darrelmiller avatar Aug 12 '18 21:08 darrelmiller

I can take a look into this more.

PerthCharern avatar Nov 28 '18 00:11 PerthCharern

Sorry, is this repo dead? So many open issues for long.

aliostad avatar Feb 03 '20 11:02 aliostad