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
Describe the bug
A clear and concise description of what the bug is.
i'm trying to build OpenApiDoc where i declare a predefined type, and i want to create a reference to that type dynamically.
i have object account , that have a field of type address , i want in openapi doc to reference the predefined object
OpenApi File To Reproduce
Add the OpenApi file you're using or a link to it as well as the steps to reproduce the current behavior.
the file is so big but theres some screenshots.
Expected behavior
A clear and concise description of what you expected to happen.
the field should have reference of type address. like this :
Screenshots/Code Snippets
If applicable, add screenshots of the stack trace or a code snippet to help explain your problem.
If applicable, add a link to your project
public static void AddAddressSchema(this OpenApiDocument openApiDoc)
{
var addressSchema = new OpenApiSchema
{
Type = ObjectType,
Properties = new Dictionary<string, OpenApiSchema>
{
{ "City", new OpenApiSchema { Type = StringType, Nullable = true } },
{ "Country", new OpenApiSchema { Type = StringType, Nullable = true } },
{ "CountryCode", new OpenApiSchema { Type = StringType, Nullable = true } }
}
};
openApiDoc.Components.Schemas.Add(AddressType, addressSchema);
}
and to assign any field that have type address i'm doing this :
OpenApiSchema AssignPredefinedSchemaReference(string id)
{
return new OpenApiSchema
{
Reference = new OpenApiReference()
{
Type = ReferenceType.Schema,
Id = id
}
};
}
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
When creating a reference there are two ways to set it up using the object model:
Set the Reference property on your addressSchema instance to identify the Type and Id of the reference, but also use the same addressSchema instance in your Account.BillingAddress property. However, note that you can't set the description and nullable property on a reference object in OpenApi 3.0. You will need to use an allOf to capture the ability for the billing address to be nullable and provide a schema for address.
Set the 'UnresolvedReference` property to true in your OpenApiSchema that just contains the Reference property. See
Describe the bug
A clear and concise description of what the bug is.
i'm trying to build OpenApiDoc where i declare a predefined type, and i want to create a reference to that type dynamically.
i have object account , that have a field of type address , i want in openapi doc to reference the predefined object
OpenApi File To Reproduce
Add the OpenApi file you're using or a link to it as well as the steps to reproduce the current behavior.
the file is so big but theres some screenshots.
Expected behavior
A clear and concise description of what you expected to happen.
the field should have reference of type address. like this :
Screenshots/Code Snippets
If applicable, add screenshots of the stack trace or a code snippet to help explain your problem.
If applicable, add a link to your project
and to assign any field that have type address i'm doing this :
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: