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
{{ message }}
Repository navigation
v2 - security - correct the proxy design implementation #1998
Another issue is that the compiler doesn't help people know which properties are writeable for a reference since it currently inherits from OpenAPISchema.
I believe that we should introduce a new interface IOpenAPISchema which ONLY has the getters for the properties.
Then all places that currently return an OpenAPISchema should be updated to return that interface. Forcing consumers to do a type assertion and handle the different cases (any property being or not writeable, or updating the source component).
The target should probably also be a public property, in case the consumers want to walk up the reference.
Lastly, the reference resolving mechanism is cumbersome for write scenarios: you need to manually register the components before they can be resolved.
Additional details from additional internal discussions:
we don't want to use an interface if we can avoid it, as adding properties would be a breaking change. Maybe introducing an abstract base class is a better middle ground.
We'll need to work on additional registration methods to make creation of documents from other object models (yoko, asp.net, etc...) easier. I'll start addressing that in an upcoming PR.
Activity
baywet commentedon Dec 27, 2024
This is also causing bugs as we copy the values from the target, but throw away the copy all the time here.
OpenAPI.NET/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs
Line 29 in f5fb254
The implementation should leverage lazy loading, and KEEP the new OpenAPI schema once created.
baywet commentedon Dec 27, 2024
Another issue is that the compiler doesn't help people know which properties are writeable for a reference since it currently inherits from OpenAPISchema.
I believe that we should introduce a new interface IOpenAPISchema which ONLY has the getters for the properties.
Then all places that currently return an OpenAPISchema should be updated to return that interface. Forcing consumers to do a type assertion and handle the different cases (any property being or not writeable, or updating the source component).
The target should probably also be a public property, in case the consumers want to walk up the reference.
Lastly, the reference resolving mechanism is cumbersome for write scenarios: you need to manually register the components before they can be resolved.
baywet commentedon Dec 30, 2024
Additional details from additional internal discussions:
darrelmiller commentedon Jan 15, 2025
The OpenApiSchema should not clone the object.
I'm not convinced about the derived base class thing. Can you add just setters in a derived class?
I'm fine with making target public.
We need to make all the references implement IOpenApiReferenceable because the walker relies on it.