Skip to content

OpenAPIReference objects are not created correctly #171

Closed
@darrelmiller

Description

@darrelmiller

When creating OpenAPI model objects that are just references to another model object they need to be marked as unresolved so that reference resolution can replace them with the resolved object.

When an object is created and assigned an OpenApiReference like this,

 OpenApiSchema derivedTypeSchema = new()
				{
                    Reference = new OpenApiReference
                    {
                        Type = ReferenceType.Schema,
                        Id = derivedType.FullName()
                    }
                };

there needs to be an assignment to the UnresolvedReference property.

 OpenApiSchema derivedTypeSchema = new()
				{
                    UnresolvedReference = true,
                    Reference = new OpenApiReference
                    {
                        Type = ReferenceType.Schema,
                        Id = derivedType.FullName()
                    }
                };

Without this flag set, client code will assume that the object is just an empty model object. The presence of an OpenApiReference object is not sufficient to identify a reference as model objects that are targeted by the reference will also have the OpenApiReference set.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions