MCPcopy Create free account
hub / github.com/goadesign/goa / validateSwagger

Function validateSwagger

http/codegen/openapi/v2/files_test.go:257–266  ·  view source on GitHub ↗

validateSwagger asserts that the given bytes contain a valid Swagger spec.

(b []byte)

Source from the content-addressed store, hash-verified

255
256// validateSwagger asserts that the given bytes contain a valid Swagger spec.
257func validateSwagger(b []byte) error {
258 doc := &openapi2.T{}
259 if err := doc.UnmarshalJSON(b); err != nil {
260 return err
261 }
262 if doc.Swagger == "" {
263 return errors.New("nil swagger")
264 }
265 return nil
266}

Callers 3

TestSectionsFunction · 0.70
TestValidationsFunction · 0.70
TestExtensionsFunction · 0.70

Calls 1

UnmarshalJSONMethod · 0.45

Tested by

no test coverage detected