Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find the JSON path of a referenced schema: Manually referenced schemas must be added to the 'Definitions' of a parent schema #1673

Open
christophdebaene opened this issue Feb 7, 2024 · 0 comments

Comments

@christophdebaene
Copy link

I get an error when calling ToJson.
I don't understand why it works fine when the type is simply Customer, but I encounter an error when it's a list.

public record Customer(string FirstName, string LastName) 
{ 
}
var settings = new SystemTextJsonSchemaGeneratorSettings();
var document = new OpenApiDocument();

JsonSchemaGenerator generator = new(settings);
OpenApiSchemaResolver resolver = new(document, settings);

var customerListType = typeof(List<Customer>);

var schema = generator.Generate(customerListType, resolver);
var jschema = schema.ToJson();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant