mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 20:47:44 +00:00
Fixed spec format setting for 3.1 in SpecInfo
This commit is contained in:
@@ -114,6 +114,7 @@ func ExtractSpecInfoWithDocumentCheck(spec []byte, bypass bool) (*SpecInfo, erro
|
|||||||
case "3.1.0", "3.1":
|
case "3.1.0", "3.1":
|
||||||
specInfo.VersionNumeric = 3.1
|
specInfo.VersionNumeric = 3.1
|
||||||
specInfo.APISchema = OpenAPI31SchemaData
|
specInfo.APISchema = OpenAPI31SchemaData
|
||||||
|
specInfo.SpecFormat = OAS31
|
||||||
default:
|
default:
|
||||||
specInfo.VersionNumeric = 3.0
|
specInfo.VersionNumeric = 3.0
|
||||||
specInfo.APISchema = OpenAPI3SchemaData
|
specInfo.APISchema = OpenAPI3SchemaData
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ func (d *document) BuildV3Model() (*DocumentModel[v3high.Document], []error) {
|
|||||||
errs = append(errs, fmt.Errorf("unable to build document, no specification has been loaded"))
|
errs = append(errs, fmt.Errorf("unable to build document, no specification has been loaded"))
|
||||||
return nil, errs
|
return nil, errs
|
||||||
}
|
}
|
||||||
if d.info.SpecFormat != datamodel.OAS3 {
|
if d.info.SpecFormat != datamodel.OAS3 && d.info.SpecFormat != datamodel.OAS31 {
|
||||||
errs = append(errs, fmt.Errorf("unable to build openapi document, "+
|
errs = append(errs, fmt.Errorf("unable to build openapi document, "+
|
||||||
"supplied spec is a different version (%v). Try 'BuildV2Model()'", d.info.SpecFormat))
|
"supplied spec is a different version (%v). Try 'BuildV2Model()'", d.info.SpecFormat))
|
||||||
return nil, errs
|
return nil, errs
|
||||||
|
|||||||
Reference in New Issue
Block a user