Skip to content

Commit 5166d3a

Browse files
authored
Merge pull request #563 from snyk/feat/allow-beta-endpoints-in-docs
feat: allow beta endpoints in docs
2 parents 8f02c16 + 0d76459 commit 5166d3a

File tree

2 files changed

+0
-46
lines changed

2 files changed

+0
-46
lines changed

tools/api-docs-generator/generator/reference_docs.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,6 @@ func processOperation(pathURL string,
152152
}
153153
}
154154

155-
if isBeta(operation) {
156-
continue
157-
}
158-
159155
tag += spec.Suffix
160156
specDocs[tag] = append(specDocs[tag], operationPath{
161157
operation: operation,
@@ -169,18 +165,6 @@ func processOperation(pathURL string,
169165
return nil
170166
}
171167

172-
func isBeta(operation *openapi3.Operation) bool {
173-
apiStabilityExtension, ok := operation.Extensions["x-snyk-api-stability"]
174-
if !ok || apiStabilityExtension == nil {
175-
return false
176-
}
177-
stabilityStr, ok := apiStabilityExtension.(string)
178-
if !ok {
179-
return false
180-
}
181-
return stabilityStr == "beta"
182-
}
183-
184168
func extractCategoryNameFromExtension(extension interface{}) (string, error) {
185169
extensionMap, worked := extension.(map[string]interface{})
186170
if !worked {

tools/api-docs-generator/generator/reference_docs_test.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -294,36 +294,6 @@ func Test_aggregateSpecs(t *testing.T) {
294294
},
295295
wantErr: assert.NoError,
296296
},
297-
{
298-
name: "filters out beta paths",
299-
args: args{
300-
cfg: &config.Config{
301-
Specs: []config.Spec{
302-
{
303-
Path: "spec_with_stability.yaml",
304-
},
305-
},
306-
},
307-
docsBasePath: "../testdata/reference_docs/",
308-
},
309-
want: map[string][]operationPath{
310-
"stable": {
311-
{
312-
method: "GET",
313-
specPath: "spec_with_stability.yaml",
314-
pathURL: "/stable-path",
315-
},
316-
},
317-
"no-stability": {
318-
{
319-
method: "GET",
320-
specPath: "spec_with_stability.yaml",
321-
pathURL: "/no-stability-path",
322-
},
323-
},
324-
},
325-
wantErr: assert.NoError,
326-
},
327297
}
328298
for _, tt := range tests {
329299
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)