Skip to content

Commit

Permalink
change descriptions, add JSONSchemaDialect
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkRosemaker committed Oct 20, 2024
1 parent 98b4a37 commit 234c773
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
4 changes: 2 additions & 2 deletions contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
)

// Contact information for the exposed API.
// ([Source])
// ([Documentation])
//
// [Source]: https://spec.openapis.org/oas/v3.1.0#contact-object
// [Documentation]: https://spec.openapis.org/oas/v3.1.0#contact-object
type Contact struct {
// The identifying name of the contact person/organization.
Name string `json:"name,omitempty,strictcase" yaml:"name,omitempty"`
Expand Down
13 changes: 10 additions & 3 deletions document.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
package openapi

import "regexp"
import (
"net/url"
"regexp"
)

// Document is an OpenAPI document.
// It is a self-contained or composite resource which defines or describes an API or elements of an API.
// An OpenAPI document uses and conforms to the OpenAPI Specification.
// ([Source])
// ([Documentation])
//
// [Source]: https://spec.openapis.org/oas/v3.1.0#openapi-document
// [Documentation]: https://spec.openapis.org/oas/v3.1.0#openapi-document
type Document struct {
// REQUIRED. This string MUST be the version number of the OpenAPI Specification that the OpenAPI document uses. The openapi field SHOULD be used by tooling to interpret the OpenAPI document. This is not related to the API info.version string.
OpenAPI string `json:"openapi,strictcase" yaml:"openapi"`
// REQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required.
Info *Info `json:"info,strictcase" yaml:"info"`
// The default value for the $schema keyword within Schema Objects contained within this OAS document. This MUST be in the form of a URI.
// Default: "https://spec.openapis.org/oas/3.1/dialect/base"
// NOTE: Anything other than the default value is not supported.
JSONSchemaDialect *url.URL `json:"jsonSchemaDialect,omitempty,strictcase" yaml:"jsonSchemaDialect,omitempty"`
}

// reOpenAPIVersion is a regular expression that matches the OpenAPI version.
Expand Down
4 changes: 2 additions & 2 deletions extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
// While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.
//
// The field name MUST begin with x-, for example, x-internal-id. Field names beginning x-oai- and x-oas- are reserved for uses defined by the OpenAPI Initiative. The value can be null, a primitive, an array or an object.
// ([Source])
// ([Documentation])
//
// It is here an alias of jsontext.Value to allow inlining within structs, enabling
// seamless marshalling and unmarshalling. Using jsontext.Value preserves the order
Expand All @@ -25,7 +25,7 @@ import (
// Note: For convenience, certain common extensions are implemented as fields
// directly within the respective structs.
//
// [Source]: https://spec.openapis.org/oas/v3.1.0#specification-extensions
// [Documentation]: https://spec.openapis.org/oas/v3.1.0#specification-extensions
type Extensions = jsontext.Value

func validateExtensions(ext Extensions) error {
Expand Down
4 changes: 2 additions & 2 deletions info.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
)

// The Info object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
// ([Source])
// ([Documentation])
//
// [Source]: https://spec.openapis.org/oas/v3.1.0#info-object
// [Documentation]: https://spec.openapis.org/oas/v3.1.0#info-object
type Info struct {
// REQUIRED. The title of the API.
Title string `json:"title,strictcase" yaml:"title"`
Expand Down
4 changes: 2 additions & 2 deletions license_struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
)

// License information for the exposed API.
// ([Source])
// ([Documentation])
//
// [Source]: https://spec.openapis.org/oas/v3.1.0#license-object
// [Documentation]: https://spec.openapis.org/oas/v3.1.0#license-object
type License struct {
// REQUIRED. The license name used for the API.
Name string `json:"name,strictcase" yaml:"name"`
Expand Down

0 comments on commit 234c773

Please sign in to comment.