Skip to content

Commit e966f0d

Browse files
CLOUDP-311375: Update foascli split command to support upcoming apis
1 parent 9e64214 commit e966f0d

File tree

8 files changed

+14
-9
lines changed

8 files changed

+14
-9
lines changed

tools/cli/internal/apiversion/version.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ func (v *APIVersion) newVersion(version string, date time.Time) {
6565
if IsPreviewStabilityLevel(version) {
6666
v.stabilityVersion = PreviewStabilityLevel
6767
}
68+
69+
if IsUpcomingStabilityLevel(version) {
70+
v.stabilityVersion = UpcomingStabilityLevel
71+
}
6872
}
6973

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

168172
func (v *APIVersion) ExactMatchOnly() bool {
169-
return v.IsPreview()
173+
return v.IsPreview() || v.IsUpcoming()
170174
}
171175

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

188+
func (v *APIVersion) IsUpcoming() bool { return IsUpcomingStabilityLevel(v.stabilityVersion) }
184189
func FindMatchesFromContentType(contentType string) []string {
185190
return contentPattern.FindStringSubmatch(contentType)
186191
}

tools/cli/internal/openapi/filter/extension.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/getkin/kin-openapi/openapi3"
1919
)
2020

21-
// ExtensionFilter: is a filter that removes the x-xgen-IPA-exception extension from the OpenAPI spec.
21+
// ExtensionFilter is a filter that removes the x-xgen-IPA-exception extension from the OpenAPI spec.
2222
type ExtensionFilter struct {
2323
oas *openapi3.T
2424
metadata *Metadata

tools/cli/internal/openapi/filter/hidden_envs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const (
2626
hiddenEnvsExtKey = "envs"
2727
)
2828

29-
// HiddenEnvsFilter: is a filter that removes paths, operations,
30-
// request/response bodies and content types that are hidden for the target environment.
29+
// HiddenEnvsFilter removes paths, operations, request/response bodies and content types
30+
// that are hidden for the target environment.
3131
type HiddenEnvsFilter struct {
3232
oas *openapi3.T
3333
metadata *Metadata

tools/cli/internal/openapi/filter/info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"github.com/mongodb/openapi/tools/cli/internal/apiversion"
2222
)
2323

24-
// InfoVersioningFilter: Filter that modifies the Info object in the OpenAPI spec with the target version.
24+
// InfoVersioningFilter modifies the Info object in the OpenAPI spec with the target version.
2525
type InfoVersioningFilter struct {
2626
oas *openapi3.T
2727
metadata *Metadata

tools/cli/internal/openapi/filter/operations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/getkin/kin-openapi/openapi3"
1919
)
2020

21-
// OperationsFilter: is a filter that removes the x-xgen-owner-team extension from operations.
21+
// OperationsFilter is a filter that removes the x-xgen-owner-team extension from operations.
2222
type OperationsFilter struct {
2323
oas *openapi3.T
2424
}

tools/cli/internal/openapi/filter/tags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/getkin/kin-openapi/openapi3"
2121
)
2222

23-
// TagsFilter: removes tags that are not used in the operations.
23+
// TagsFilter removes tags that are not used in the operations.
2424
type TagsFilter struct {
2525
oas *openapi3.T
2626
}

tools/cli/internal/openapi/filter/versioning.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/mongodb/openapi/tools/cli/internal/apiversion"
2323
)
2424

25-
// VersioningFilter: is a filter that modifies the OpenAPI spec by removing operations and responses
25+
// VersioningFilter is a filter that modifies the OpenAPI spec by removing paths, operations and responses
2626
// that are not supported by the target version.
2727
type VersioningFilter struct {
2828
oas *openapi3.T

tools/cli/internal/openapi/filter/versioning_extension.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/mongodb/openapi/tools/cli/internal/apiversion"
2323
)
2424

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

0 commit comments

Comments
 (0)