Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tools/cli/internal/apiversion/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func (v *APIVersion) newVersion(version string, date time.Time) {
if IsPreviewStabilityLevel(version) {
v.stabilityVersion = PreviewStabilityLevel
}

if IsUpcomingStabilityLevel(version) {
v.stabilityVersion = UpcomingStabilityLevel
}
}

// WithVersion sets the version on the APIVersion.
Expand Down Expand Up @@ -166,7 +170,7 @@ func (v *APIVersion) StabilityLevel() string {
}

func (v *APIVersion) ExactMatchOnly() bool {
return v.IsPreview()
return v.IsPreview() || v.IsUpcoming()
}

func (v *APIVersion) IsPreview() bool {
Expand All @@ -181,6 +185,7 @@ func (v *APIVersion) IsPublicPreview() bool {
return v.IsPreview() && !v.IsPrivatePreview()
}

func (v *APIVersion) IsUpcoming() bool { return IsUpcomingStabilityLevel(v.stabilityVersion) }
func FindMatchesFromContentType(contentType string) []string {
return contentPattern.FindStringSubmatch(contentType)
}
Expand Down
2 changes: 1 addition & 1 deletion tools/cli/internal/openapi/filter/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/getkin/kin-openapi/openapi3"
)

// ExtensionFilter: is a filter that removes the x-xgen-IPA-exception extension from the OpenAPI spec.
// ExtensionFilter is a filter that removes the x-xgen-IPA-exception extension from the OpenAPI spec.
type ExtensionFilter struct {
oas *openapi3.T
metadata *Metadata
Expand Down
4 changes: 2 additions & 2 deletions tools/cli/internal/openapi/filter/hidden_envs.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const (
hiddenEnvsExtKey = "envs"
)

// HiddenEnvsFilter: is a filter that removes paths, operations,
// request/response bodies and content types that are hidden for the target environment.
// HiddenEnvsFilter removes paths, operations, request/response bodies and content types
// that are hidden for the target environment.
type HiddenEnvsFilter struct {
oas *openapi3.T
metadata *Metadata
Expand Down
2 changes: 1 addition & 1 deletion tools/cli/internal/openapi/filter/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/mongodb/openapi/tools/cli/internal/apiversion"
)

// InfoVersioningFilter: Filter that modifies the Info object in the OpenAPI spec with the target version.
// InfoVersioningFilter modifies the Info object in the OpenAPI spec with the target version.
type InfoVersioningFilter struct {
oas *openapi3.T
metadata *Metadata
Expand Down
2 changes: 1 addition & 1 deletion tools/cli/internal/openapi/filter/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/getkin/kin-openapi/openapi3"
)

// OperationsFilter: is a filter that removes the x-xgen-owner-team extension from operations.
// OperationsFilter is a filter that removes the x-xgen-owner-team extension from operations.
type OperationsFilter struct {
oas *openapi3.T
}
Expand Down
2 changes: 1 addition & 1 deletion tools/cli/internal/openapi/filter/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/getkin/kin-openapi/openapi3"
)

// TagsFilter: removes tags that are not used in the operations.
// TagsFilter removes tags that are not used in the operations.
type TagsFilter struct {
oas *openapi3.T
}
Expand Down
2 changes: 1 addition & 1 deletion tools/cli/internal/openapi/filter/versioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/mongodb/openapi/tools/cli/internal/apiversion"
)

// VersioningFilter: is a filter that modifies the OpenAPI spec by removing operations and responses
// VersioningFilter is a filter that modifies the OpenAPI spec by removing paths, operations and responses
// that are not supported by the target version.
type VersioningFilter struct {
oas *openapi3.T
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/mongodb/openapi/tools/cli/internal/apiversion"
)

// VersioningExtensionFilter: is a filter that updates the x-sunset and x-xgen-version extensions to a date string
// VersioningExtensionFilter is a filter that updates the x-sunset and x-xgen-version extensions to a date string
// and deletes the x-sunset extension if the latest matched version is deprecated by hidden versions
// for the target environment.
type VersioningExtensionFilter struct {
Expand Down
Loading