@@ -94,6 +94,10 @@ type Config struct {
9494 // or any of the models will result in spec generation failure.
9595 GetDefinitions GetOpenAPIDefinitions
9696
97+ // Provides the definition for all models used by routes. One of GetDefinitions or Definitions must be defined to generate a spec.
98+ // This takes precedent over the GetDefinitions function
99+ Definitions map [string ]OpenAPIDefinition
100+
97101 // GetOperationIDAndTags returns operation id and tags for a restful route. It is an optional function to customize operation IDs.
98102 //
99103 // Deprecated: GetOperationIDAndTagsFromRoute should be used instead. This cannot be specified if using the new Route
@@ -141,8 +145,13 @@ type OpenAPIV3Config struct {
141145
142146 // OpenAPIDefinitions should provide definition for all models used by routes. Failure to provide this map
143147 // or any of the models will result in spec generation failure.
148+ // One of GetDefinitions or Definitions must be defined to generate a spec.
144149 GetDefinitions GetOpenAPIDefinitions
145150
151+ // Provides the definition for all models used by routes. One of GetDefinitions or Definitions must be defined to generate a spec.
152+ // This takes precedent over the GetDefinitions function
153+ Definitions map [string ]OpenAPIDefinition
154+
146155 // GetOperationIDAndTags returns operation id and tags for a restful route. It is an optional function to customize operation IDs.
147156 //
148157 // Deprecated: GetOperationIDAndTagsFromRoute should be used instead. This cannot be specified if using the new Route
@@ -176,12 +185,13 @@ func ConvertConfigToV3(config *Config) *OpenAPIV3Config {
176185 GetOperationIDAndTags : config .GetOperationIDAndTags ,
177186 GetOperationIDAndTagsFromRoute : config .GetOperationIDAndTagsFromRoute ,
178187 GetDefinitionName : config .GetDefinitionName ,
188+ Definitions : config .Definitions ,
179189 SecuritySchemes : make (spec3.SecuritySchemes ),
180190 DefaultSecurity : config .DefaultSecurity ,
181191 DefaultResponse : openapiconv .ConvertResponse (config .DefaultResponse , []string {"application/json" }),
182192
183- CommonResponses : make (map [int ]* spec3.Response ),
184- ResponseDefinitions : make (map [string ]* spec3.Response ),
193+ CommonResponses : make (map [int ]* spec3.Response ),
194+ ResponseDefinitions : make (map [string ]* spec3.Response ),
185195 }
186196
187197 if config .SecurityDefinitions != nil {
0 commit comments