GitHub - go-openapi/spec: openapi specification object model (original) (raw)

Skip to content

Sign in

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Sign in

Sign up

Appearance settings

go-openapi / spec Public

openapi specification object model

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0 LICENSE Unknown license.go

410 stars 102 forks Branches Tags Activity

Star

Notifications You must be signed in to change notification settings

Additional navigation options

BranchesTags

Folders and files

Name Name Last commit message Last commit date
Latest commitHistory385 Commits
.github .github
fixtures fixtures
schemas schemas
.editorconfig .editorconfig
.gitignore .gitignore
.golangci.yml .golangci.yml
CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md
LICENSE LICENSE
README.md README.md
auth_test.go auth_test.go
cache.go cache.go
cache_test.go cache_test.go
circular_test.go circular_test.go
contact_info.go contact_info.go
contact_info_test.go contact_info_test.go
debug.go debug.go
debug_test.go debug_test.go
embed.go embed.go
errors.go errors.go
expander.go expander.go
expander_test.go expander_test.go
external_docs.go external_docs.go
external_docs_test.go external_docs_test.go
go.mod go.mod
go.sum go.sum
header.go header.go
header_test.go header_test.go
helpers_spec_test.go helpers_spec_test.go
helpers_test.go helpers_test.go
info.go info.go
info_test.go info_test.go
items.go items.go
items_test.go items_test.go
license.go license.go
license_test.go license_test.go
normalizer.go normalizer.go
normalizer_nonwindows.go normalizer_nonwindows.go
normalizer_test.go normalizer_test.go
normalizer_windows.go normalizer_windows.go
operation.go operation.go
operation_test.go operation_test.go
parameter.go parameter.go
parameters_test.go parameters_test.go
path_item.go path_item.go
path_item_test.go path_item_test.go
paths.go paths.go
paths_test.go paths_test.go
properties.go properties.go
properties_test.go properties_test.go
ref.go ref.go
ref_test.go ref_test.go
resolver.go resolver.go
resolver_test.go resolver_test.go
response.go response.go
response_test.go response_test.go
responses.go responses.go
responses_test.go responses_test.go
schema.go schema.go
schema_loader.go schema_loader.go
schema_loader_test.go schema_loader_test.go
schema_test.go schema_test.go
security_scheme.go security_scheme.go
spec.go spec.go
spec_test.go spec_test.go
structs_test.go structs_test.go
swagger.go swagger.go
swagger_test.go swagger_test.go
tag.go tag.go
url_go19.go url_go19.go
validations.go validations.go
validations_test.go validations_test.go
xml_object.go xml_object.go
xml_object_test.go xml_object_test.go

Repository files navigation

OpenAPI v2 object model Build Status codecov

Slack Status license Go Reference Go Report Card

The object model for OpenAPI specification documents.

FAQ

  1. This package knows how to marshal and unmarshal Swagger API specifications into a golang object model
  2. It knows how to resolve $ref and expand them to make a single root document
  1. This package is at the core of the go-openapi suite of packages and code generator
  2. There is a spec loading package to fetch specs as JSON or YAML from local or remote locations
  3. There is a spec validation package built on top of it
  4. There is a spec analysis package built on top of it, to analyze, flatten, fix and merge spec documents

No. This package currently only supports OpenAPI 2.0 (aka Swagger 2.0). There is no plan to make it evolve toward supporting OpenAPI 3.x. This discussion thread relates the full story.

An early attempt to support Swagger 3 may be found at: https://github.com/go-openapi/spec3

Not directly. The exposed types know only how to unmarshal from JSON.

In order to load a YAML document as a Swagger spec, you need to use the loaders provided by github.com/go-openapi/loads

Take a look at the example there: https://pkg.go.dev/github.com/go-openapi/loads#example-Spec

See also #164

Validation is provided by the validate package

We found jsonschema compatibility more important: since id in jsonschema influences how $ref are resolved. This id does not conflict with any property named id.

See also #23

About

openapi specification object model

Resources

Readme

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0 LICENSE Unknown license.go

Code of conduct

Code of conduct

Activity

Custom properties

Stars

410 stars

Watchers

8 watching

Forks

102 forks

Report repository

Releases

38 tags

Packages

No packages published

Used by 84k

@silentstranger5 @dasarpai @hamidjon04 @fireship @2022124030jc @jungtechou @MuhammadAzhar9 @InazumaV + 83,947

Contributors39

+ 25 contributors

Languages