Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

v2: Handle relative references in OpenApiSchemaReference type #2062

Copy link
Copy link
@captainsafia

Description

@captainsafia
Issue body actions

The OpenApiSchemaReference type included in this package provides support for resolving schema references to the top-level components.schemas object. The object doesn't play nice if the reference is a relative reference to a property in a recursive schema.

The serializer seems to detect these relative references correctly and serialize the correct references. It would be great if these resolutions also worked in the object model, particularly for users taking advantage of consuming APIs' in ASP.NET Core like OpenAPI schema transformers.

For example, given the following type hierarchy:

public class A
{
	public B B { get; }
}

public class B
{
	public C C { get; }
}

public class C
{
	public B B { get; set; } 
}

And the following schema:

{
  "type": [
    "object",
    "null"
  ],
  "properties": {
    "b": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "c": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "b": {
              "$ref": "#/properties/b"
            }
          }
        }
      }
    }
  }
}

#/properties/b should map to the properties.b schema when interacting with the OpenApiSchemaReference object for the schema.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7daysHigh priority but not blocking. Causes major but not critical loss of functionality SLA <=7days

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.