swaggest / openapi-go

OpenAPI structures for Go
https://pkg.go.dev/github.com/swaggest/openapi-go/openapi3
MIT License
259 stars 23 forks source link

[Question] Is there a way to select if a struct schema is a ref or not ? #54

Closed Fifi31 closed 1 year ago

Fifi31 commented 1 year ago

Hello,

I noticed that every schema is put in reflector.Spec.Components.Schemas.MapOfSchemaOrRefValues, even structs that are fields of other structs, which are referenced in reflector.Spec.Components.Schemas.MapOfSchemaOrRefValues["Struct"].Schema.Properties["Field"].Schema.Items.SchemaReference.

Is there some options that can be used so schemas of fields of structs are set in reflector.Spec.Components.Schemas.MapOfSchemaOrRefValues["Struct"].Schema.Properties["Field"].Schema.Items.Schema directly ?

It is just a question, no problem if it is not possible.

vearutop commented 1 year ago

I'm sorry, I don't understand. 😅

Could you make a small example to clarify expectations?

vearutop commented 1 year ago

And btw, since this is a question it is better to move to discussions so that the topic is more visible to other people that may have same question.

Fifi31 commented 1 year ago

I didn't know the discussions feature on github, I will switch to it and provide an example !