apib2swagger 1.17.0 → 1.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/docker-publish.yml +22 -7
- package/.github/workflows/nodejs.yml +61 -4
- package/.github/workflows/publish.yml +41 -0
- package/Dockerfile +1 -1
- package/README.md +1 -1
- package/index.js +14 -2
- package/package.json +5 -6
- package/src/mson_to_json_schema.js +28 -9
- package/src/responses.js +27 -11
- package/test/input/Issue-#50.md +19 -0
- package/test/input/OpenAPI3_Issue-#73.md +21 -0
- package/test/input/OpenAPI3_Issue-#79.md +16 -0
- package/test/output/02. Resource and Actions.json +1 -1
- package/test/output/02. Resource and Actions.ref.json +1 -1
- package/test/output/Issue-#50.json +73 -0
- package/test/output/Issue-#50.ref.json +73 -0
- package/test/output/OpenAPI3_Issue-#73.json +69 -0
- package/test/output/OpenAPI3_Issue-#73.ref.json +63 -0
- package/test/output/OpenAPI3_Issue-#79.json +58 -0
- package/test/output/OpenAPI3_Issue-#79.ref.json +58 -0
- package/test/output/OpenAPI3_attributes.json +2 -2
- package/test/output/OpenAPI3_attributes.ref.json +2 -2
- package/test/output/OpenAPI3_requests.json +4 -4
- package/test/output/OpenAPI3_requests.ref.json +4 -4
- package/test/output/OpenAPI3_responses.json +2 -2
- package/test/output/OpenAPI3_responses.ref.json +2 -2
- package/test/output/Schema.json +1 -1
- package/test/output/Schema.ref.json +1 -1
- package/test/test.js +5 -1
- package/.travis.yml +0 -6
|
@@ -24,16 +24,17 @@ jobs:
|
|
|
24
24
|
runs-on: ubuntu-latest
|
|
25
25
|
|
|
26
26
|
steps:
|
|
27
|
-
- uses: actions/checkout@
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
28
|
|
|
29
29
|
- name: Run tests
|
|
30
30
|
run: |
|
|
31
31
|
if [ -f docker-compose.test.yml ]; then
|
|
32
|
-
docker
|
|
33
|
-
docker
|
|
32
|
+
docker compose --file docker-compose.test.yml build
|
|
33
|
+
docker compose --file docker-compose.test.yml run sut
|
|
34
34
|
else
|
|
35
35
|
docker build . --file Dockerfile
|
|
36
36
|
fi
|
|
37
|
+
|
|
37
38
|
# Push image to GitHub Packages.
|
|
38
39
|
# See also https://docs.docker.com/docker-hub/builds/
|
|
39
40
|
push:
|
|
@@ -43,28 +44,42 @@ jobs:
|
|
|
43
44
|
runs-on: ubuntu-latest
|
|
44
45
|
if: github.event_name == 'push'
|
|
45
46
|
|
|
47
|
+
# Log into GHCR with the built-in GITHUB_TOKEN; no PAT needed.
|
|
48
|
+
permissions:
|
|
49
|
+
contents: read
|
|
50
|
+
packages: write
|
|
51
|
+
|
|
46
52
|
steps:
|
|
47
|
-
- uses: actions/checkout@
|
|
53
|
+
- uses: actions/checkout@v4
|
|
48
54
|
|
|
49
55
|
- name: Build image
|
|
50
56
|
run: docker build . --file Dockerfile --tag $IMAGE_NAME
|
|
51
57
|
|
|
52
58
|
- name: Log into GitHub Container Registry
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
uses: docker/login-action@v3
|
|
60
|
+
with:
|
|
61
|
+
registry: ghcr.io
|
|
62
|
+
username: ${{ github.actor }}
|
|
63
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
55
64
|
|
|
56
65
|
- name: Push image to GitHub Container Registry
|
|
57
66
|
run: |
|
|
58
67
|
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
|
|
68
|
+
|
|
59
69
|
# Change all uppercase to lowercase
|
|
60
70
|
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
|
71
|
+
|
|
61
72
|
# Strip git ref prefix from version
|
|
62
73
|
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
|
74
|
+
|
|
63
75
|
# Strip "v" prefix from tag name
|
|
64
76
|
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
|
77
|
+
|
|
65
78
|
# Use Docker `latest` tag convention
|
|
66
79
|
[ "$VERSION" == "master" ] && VERSION=latest
|
|
80
|
+
|
|
67
81
|
echo IMAGE_ID=$IMAGE_ID
|
|
68
82
|
echo VERSION=$VERSION
|
|
83
|
+
|
|
69
84
|
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
|
|
70
|
-
docker push $IMAGE_ID:$VERSION
|
|
85
|
+
docker push $IMAGE_ID:$VERSION
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: CI
|
|
2
2
|
|
|
3
3
|
on: [push]
|
|
4
4
|
|
|
@@ -9,12 +9,12 @@ jobs:
|
|
|
9
9
|
|
|
10
10
|
strategy:
|
|
11
11
|
matrix:
|
|
12
|
-
node-version: [
|
|
12
|
+
node-version: [22.x, 24.x, 26.x]
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
16
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
17
|
-
uses: actions/setup-node@
|
|
17
|
+
uses: actions/setup-node@v4
|
|
18
18
|
with:
|
|
19
19
|
node-version: ${{ matrix.node-version }}
|
|
20
20
|
- name: npm install, build, and test
|
|
@@ -24,3 +24,60 @@ jobs:
|
|
|
24
24
|
npm test
|
|
25
25
|
env:
|
|
26
26
|
CI: true
|
|
27
|
+
|
|
28
|
+
bun:
|
|
29
|
+
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
- name: Use Bun
|
|
35
|
+
uses: oven-sh/setup-bun@v2
|
|
36
|
+
- name: bun install and test
|
|
37
|
+
run: |
|
|
38
|
+
bun install
|
|
39
|
+
bun run test
|
|
40
|
+
env:
|
|
41
|
+
CI: true
|
|
42
|
+
|
|
43
|
+
deno:
|
|
44
|
+
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
- name: Use Deno
|
|
50
|
+
uses: denoland/setup-deno@v2
|
|
51
|
+
with:
|
|
52
|
+
deno-version: v2.x
|
|
53
|
+
- name: deno install and test
|
|
54
|
+
run: |
|
|
55
|
+
deno install
|
|
56
|
+
deno run -A npm:mocha
|
|
57
|
+
env:
|
|
58
|
+
CI: true
|
|
59
|
+
|
|
60
|
+
coverage:
|
|
61
|
+
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/checkout@v4
|
|
66
|
+
- name: Use Node.js 26.x
|
|
67
|
+
uses: actions/setup-node@v4
|
|
68
|
+
with:
|
|
69
|
+
node-version: 26.x
|
|
70
|
+
- name: npm install, build, and test
|
|
71
|
+
run: |
|
|
72
|
+
npm ci
|
|
73
|
+
npm run build --if-present
|
|
74
|
+
npm test
|
|
75
|
+
env:
|
|
76
|
+
CI: true
|
|
77
|
+
- name: Generate lcov report
|
|
78
|
+
run: npx nyc report --reporter=text-lcov > coverage.lcov
|
|
79
|
+
- name: Send coverage to Coveralls
|
|
80
|
+
uses: coverallsapp/github-action@v2
|
|
81
|
+
with:
|
|
82
|
+
file: ./coverage.lcov
|
|
83
|
+
format: lcov
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- v*
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
id-token: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- name: Use Node.js 24.x
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: 24.x
|
|
23
|
+
registry-url: 'https://registry.npmjs.org'
|
|
24
|
+
- name: Update npm (staged publishing requires npm >= 11.15.0)
|
|
25
|
+
run: npm install -g npm@latest
|
|
26
|
+
- name: Check the tag matches the package version
|
|
27
|
+
run: |
|
|
28
|
+
PKG_VERSION=$(node -p "require('./package.json').version")
|
|
29
|
+
if [ "v$PKG_VERSION" != "$GITHUB_REF_NAME" ]; then
|
|
30
|
+
echo "Tag $GITHUB_REF_NAME does not match package.json version $PKG_VERSION"
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
- name: npm install, build, and test
|
|
34
|
+
run: |
|
|
35
|
+
npm ci
|
|
36
|
+
npm run build --if-present
|
|
37
|
+
npm test
|
|
38
|
+
env:
|
|
39
|
+
CI: true
|
|
40
|
+
- name: Stage on npm (goes live after maintainer approval)
|
|
41
|
+
run: npm stage publish
|
package/Dockerfile
CHANGED
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -50,7 +50,7 @@ var apib2swagger = module.exports.convertParsed = function (apib, options) {
|
|
|
50
50
|
output.securityDefinitions = {};
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
var converterContext = { swagger: output, options: options };
|
|
53
|
+
var converterContext = { swagger: output, options: options, operationIds: {}, usedOperationIds: new Set() };
|
|
54
54
|
var tags = {};
|
|
55
55
|
apib.content.filter(function (content) {
|
|
56
56
|
return content.element === 'category';
|
|
@@ -156,10 +156,22 @@ var swaggerPaths = function (context, tag, resource) {
|
|
|
156
156
|
};
|
|
157
157
|
|
|
158
158
|
var swaggerOperation = function (context, pathParams, uriTemplate, action, tag) {
|
|
159
|
+
var opId = action.name;
|
|
160
|
+
if (context.usedOperationIds.has(opId)) {
|
|
161
|
+
var count = (context.operationIds[opId] || 1) + 1;
|
|
162
|
+
while (context.usedOperationIds.has(opId + '_' + count)) {
|
|
163
|
+
count++;
|
|
164
|
+
}
|
|
165
|
+
context.operationIds[opId] = count;
|
|
166
|
+
opId = opId + '_' + count;
|
|
167
|
+
} else {
|
|
168
|
+
context.operationIds[opId] = 1;
|
|
169
|
+
}
|
|
170
|
+
context.usedOperationIds.add(opId);
|
|
159
171
|
var operation = {
|
|
160
172
|
'responses': processResponses(action.examples, context.options),
|
|
161
173
|
'summary': action.name,
|
|
162
|
-
'operationId':
|
|
174
|
+
'operationId': opId,
|
|
163
175
|
'description': action.description,
|
|
164
176
|
'tags': tag ? [tag] : [],
|
|
165
177
|
'parameters': pathParams.concat(processParameters(action.parameters, uriTemplate, context.options))
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apib2swagger",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.2",
|
|
4
4
|
"description": "Convert API Blueprint to Swagger.",
|
|
5
5
|
"bin": "./bin/apib2swagger.js",
|
|
6
|
+
"type": "commonjs",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"prepareTest": "cross-env PREPARE=true mocha",
|
|
8
|
-
"test": "nyc --reporter=html --reporter=text mocha"
|
|
9
|
-
"coverage": "nyc report --reporter=text-lcov | coveralls"
|
|
9
|
+
"test": "nyc --reporter=html --reporter=text mocha"
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -27,10 +27,9 @@
|
|
|
27
27
|
"uritemplate": "^0.3.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"coveralls": "^3.1.1",
|
|
31
30
|
"cross-env": "^5.2.0",
|
|
32
|
-
"mocha": "^
|
|
33
|
-
"nyc": "^
|
|
31
|
+
"mocha": "^12.0.3",
|
|
32
|
+
"nyc": "^18.0.0",
|
|
34
33
|
"sinon": "^12.0.1",
|
|
35
34
|
"tv4": "^1.2.7"
|
|
36
35
|
}
|
|
@@ -32,7 +32,7 @@ function convert(mson, options) {
|
|
|
32
32
|
return { type: 'array', items: { 'anyOf': mson.content.map((m) => convert(m, options)) } };
|
|
33
33
|
}
|
|
34
34
|
case 'enum':
|
|
35
|
-
return convertEnum(mson.content);
|
|
35
|
+
return convertEnum(mson.content, componentsPath);
|
|
36
36
|
case 'object':
|
|
37
37
|
break;
|
|
38
38
|
case 'boolean':
|
|
@@ -98,19 +98,38 @@ function convert(mson, options) {
|
|
|
98
98
|
return schema;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
function convertEnum(contents) {
|
|
101
|
+
function convertEnum(contents, componentsPath) {
|
|
102
102
|
if (!contents) return null
|
|
103
|
-
|
|
103
|
+
const schemaList = []
|
|
104
104
|
for (var i = 0; i < contents.length; i++) {
|
|
105
105
|
var content = contents[i];
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
switch (content.element) {
|
|
107
|
+
case "boolean":
|
|
108
|
+
case "string":
|
|
109
|
+
case "number":
|
|
110
|
+
case "array":
|
|
111
|
+
case "enum": // TODO
|
|
112
|
+
case "object":
|
|
113
|
+
let schema = schemaList.find(v => v.type === content.element)
|
|
114
|
+
if (!schema) {
|
|
115
|
+
schema = { type: content.element, enum: [] }
|
|
116
|
+
schemaList.push(schema)
|
|
117
|
+
}
|
|
118
|
+
schema.enum.push(content.content)
|
|
119
|
+
break
|
|
120
|
+
default: // CustomType
|
|
121
|
+
schemaList.push({ '$ref': componentsPath + escapeJSONPointer(content.element) })
|
|
122
|
+
break
|
|
110
123
|
}
|
|
111
|
-
schema.enum.push(content.content);
|
|
112
124
|
}
|
|
113
|
-
|
|
125
|
+
switch (schemaList.length) {
|
|
126
|
+
case 0:
|
|
127
|
+
return {}
|
|
128
|
+
case 1:
|
|
129
|
+
return schemaList[0]
|
|
130
|
+
default:
|
|
131
|
+
return { oneOf: schemaList}
|
|
132
|
+
}
|
|
114
133
|
}
|
|
115
134
|
|
|
116
135
|
module.exports = convertMsonToJsonSchema;
|
package/src/responses.js
CHANGED
|
@@ -3,6 +3,7 @@ const escapeJSONPointer = require('./escape_json_pointer')
|
|
|
3
3
|
const isEqual = require('lodash.isequal')
|
|
4
4
|
const http = require('http')
|
|
5
5
|
const toOpenApi = require('json-schema-to-openapi-schema')
|
|
6
|
+
const generateSchema = require('generate-schema')
|
|
6
7
|
|
|
7
8
|
const parseResponseSchema = (schema, options) => {
|
|
8
9
|
if (!schema) return
|
|
@@ -71,26 +72,41 @@ const setResponseSchema = (responses, response, schema, options) => {
|
|
|
71
72
|
responses[response.name].schema = schema
|
|
72
73
|
return responses
|
|
73
74
|
}
|
|
75
|
+
if (schema.type === 'extend') { // Workaround for invalid JSON schema
|
|
76
|
+
if (schema.enum.length > 0) {
|
|
77
|
+
schema = generateSchema.json('', schema.enum[0])
|
|
78
|
+
} else {
|
|
79
|
+
schema.type = 'object'
|
|
80
|
+
}
|
|
81
|
+
}
|
|
74
82
|
// Convert JSON Schema draft04 to OpenAPI 3.0.x (type: null -> nullable: true)
|
|
75
83
|
// TODO: Skip this for OpenAPI 3.1.x or later.
|
|
76
|
-
|
|
84
|
+
try {
|
|
85
|
+
schema = toOpenApi(schema)
|
|
86
|
+
} catch (e) {
|
|
87
|
+
return responses // TODO: Handle error
|
|
88
|
+
}
|
|
77
89
|
|
|
78
|
-
// In openAPI 3 the schema lives under the content type
|
|
90
|
+
// In openAPI 3 the schema lives under the content type.
|
|
91
|
+
// A response is not required to declare a Content-Type header
|
|
92
|
+
// (see API Blueprint specification); fall back to application/json,
|
|
93
|
+
// mirroring how requests are handled in requests.js.
|
|
79
94
|
const contentTypeHeader = response.headers.find((h) => h.name.toLowerCase() === 'content-type')
|
|
80
|
-
|
|
95
|
+
const contentType = contentTypeHeader ? contentTypeHeader.value : 'application/json'
|
|
96
|
+
if (!contentType) {
|
|
81
97
|
return responses
|
|
82
98
|
}
|
|
83
|
-
if (!responses[response.name].content[
|
|
84
|
-
responses[response.name].content[
|
|
99
|
+
if (!responses[response.name].content[contentType]){
|
|
100
|
+
responses[response.name].content[contentType] = {}
|
|
85
101
|
}
|
|
86
|
-
|
|
87
|
-
if (!responses[response.name].content[
|
|
88
|
-
responses[response.name].content[
|
|
102
|
+
|
|
103
|
+
if (!responses[response.name].content[contentType].schema){
|
|
104
|
+
responses[response.name].content[contentType].schema = schema
|
|
89
105
|
return responses
|
|
90
106
|
}
|
|
91
107
|
|
|
92
108
|
// If a schema already exists, we need to use oneOf for additional unique schemas.
|
|
93
|
-
let existingSchema = { ...responses[response.name].content[
|
|
109
|
+
let existingSchema = { ...responses[response.name].content[contentType].schema }
|
|
94
110
|
// It is possible that the given schema is a duplicate. If that's the case, we don't add it.
|
|
95
111
|
if (isEqual(existingSchema, schema)){
|
|
96
112
|
return responses
|
|
@@ -98,10 +114,10 @@ const setResponseSchema = (responses, response, schema, options) => {
|
|
|
98
114
|
|
|
99
115
|
if (existingSchema.oneOf){
|
|
100
116
|
if (!existingSchema.oneOf.find((s) => isEqual(s, schema))){
|
|
101
|
-
responses[response.name].content[
|
|
117
|
+
responses[response.name].content[contentType].schema.oneOf.push(schema)
|
|
102
118
|
}
|
|
103
119
|
} else {
|
|
104
|
-
responses[response.name].content[
|
|
120
|
+
responses[response.name].content[contentType].schema = { oneOf: [existingSchema, schema] }
|
|
105
121
|
}
|
|
106
122
|
return responses
|
|
107
123
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
FORMAT: 1A
|
|
2
|
+
HOST: http://example.org
|
|
3
|
+
|
|
4
|
+
# API
|
|
5
|
+
|
|
6
|
+
## Users [/users]
|
|
7
|
+
|
|
8
|
+
### List [GET]
|
|
9
|
+
+ Response 200 (application/json)
|
|
10
|
+
|
|
11
|
+
## Items [/items]
|
|
12
|
+
|
|
13
|
+
### List_2 [GET]
|
|
14
|
+
+ Response 200 (application/json)
|
|
15
|
+
|
|
16
|
+
## Products [/products]
|
|
17
|
+
|
|
18
|
+
### List [GET]
|
|
19
|
+
+ Response 200 (application/json)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
FORMAT: 1A
|
|
2
|
+
HOST: http://127.0.0.1/api/v1
|
|
3
|
+
|
|
4
|
+
# Group Extensions
|
|
5
|
+
|
|
6
|
+
## Extensions [/extensions]
|
|
7
|
+
|
|
8
|
+
### Get extensions [GET]
|
|
9
|
+
|
|
10
|
+
+ Response 200 (application/json)
|
|
11
|
+
+ Attributes (Extension)
|
|
12
|
+
|
|
13
|
+
## Data Structures
|
|
14
|
+
|
|
15
|
+
### Extension (enum)
|
|
16
|
+
|
|
17
|
+
+ (Foo type)
|
|
18
|
+
|
|
19
|
+
### Foo type (object, fixed-type)
|
|
20
|
+
|
|
21
|
+
+ id (string) - the id
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
FORMAT: 1A
|
|
2
|
+
HOST: http://example.org
|
|
3
|
+
|
|
4
|
+
# My Title
|
|
5
|
+
|
|
6
|
+
This is some blueprint
|
|
7
|
+
|
|
8
|
+
# Group A Group
|
|
9
|
+
|
|
10
|
+
## Some URL [/some/url]
|
|
11
|
+
|
|
12
|
+
### Some super awesome endpoint [PUT]
|
|
13
|
+
+ Request
|
|
14
|
+
+ Attributes (object)
|
|
15
|
+
+ Response 200
|
|
16
|
+
+ Attributes (object)
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"summary": "",
|
|
39
|
-
"operationId": "",
|
|
39
|
+
"operationId": "_2",
|
|
40
40
|
"description": "OK, let's add another action. This time to put new data to our resource (essentially an update action). We will need to send something in a [request](http://www.w3.org/TR/di-gloss/#def-http-request) and then send a response back confirming the posting was a success (HTTP Status Code 204 ~ Resource updated successfully, no content is returned).",
|
|
41
41
|
"tags": [],
|
|
42
42
|
"parameters": [],
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"summary": "",
|
|
39
|
-
"operationId": "",
|
|
39
|
+
"operationId": "_2",
|
|
40
40
|
"description": "OK, let's add another action. This time to put new data to our resource (essentially an update action). We will need to send something in a [request](http://www.w3.org/TR/di-gloss/#def-http-request) and then send a response back confirming the posting was a success (HTTP Status Code 204 ~ Resource updated successfully, no content is returned).",
|
|
41
41
|
"tags": [],
|
|
42
42
|
"parameters": [],
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"swagger": "2.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "API",
|
|
5
|
+
"version": "",
|
|
6
|
+
"description": ""
|
|
7
|
+
},
|
|
8
|
+
"host": "example.org",
|
|
9
|
+
"basePath": "/",
|
|
10
|
+
"schemes": [
|
|
11
|
+
"http"
|
|
12
|
+
],
|
|
13
|
+
"paths": {
|
|
14
|
+
"/users": {
|
|
15
|
+
"get": {
|
|
16
|
+
"responses": {
|
|
17
|
+
"200": {
|
|
18
|
+
"description": "OK",
|
|
19
|
+
"headers": {},
|
|
20
|
+
"examples": {}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"summary": "List",
|
|
24
|
+
"operationId": "List",
|
|
25
|
+
"description": "",
|
|
26
|
+
"tags": [],
|
|
27
|
+
"parameters": [],
|
|
28
|
+
"consumes": []
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"/items": {
|
|
32
|
+
"get": {
|
|
33
|
+
"responses": {
|
|
34
|
+
"200": {
|
|
35
|
+
"description": "OK",
|
|
36
|
+
"headers": {},
|
|
37
|
+
"examples": {}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"summary": "List_2",
|
|
41
|
+
"operationId": "List_2",
|
|
42
|
+
"description": "",
|
|
43
|
+
"tags": [],
|
|
44
|
+
"parameters": [],
|
|
45
|
+
"consumes": []
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"/products": {
|
|
49
|
+
"get": {
|
|
50
|
+
"responses": {
|
|
51
|
+
"200": {
|
|
52
|
+
"description": "OK",
|
|
53
|
+
"headers": {},
|
|
54
|
+
"examples": {}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"summary": "List",
|
|
58
|
+
"operationId": "List_3",
|
|
59
|
+
"description": "",
|
|
60
|
+
"tags": [],
|
|
61
|
+
"parameters": [],
|
|
62
|
+
"consumes": []
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"definitions": {
|
|
67
|
+
"Users": {},
|
|
68
|
+
"Items": {},
|
|
69
|
+
"Products": {}
|
|
70
|
+
},
|
|
71
|
+
"securityDefinitions": {},
|
|
72
|
+
"tags": []
|
|
73
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"swagger": "2.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "API",
|
|
5
|
+
"version": "",
|
|
6
|
+
"description": ""
|
|
7
|
+
},
|
|
8
|
+
"host": "example.org",
|
|
9
|
+
"basePath": "/",
|
|
10
|
+
"schemes": [
|
|
11
|
+
"http"
|
|
12
|
+
],
|
|
13
|
+
"paths": {
|
|
14
|
+
"/users": {
|
|
15
|
+
"get": {
|
|
16
|
+
"responses": {
|
|
17
|
+
"200": {
|
|
18
|
+
"description": "OK",
|
|
19
|
+
"headers": {},
|
|
20
|
+
"examples": {}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"summary": "List",
|
|
24
|
+
"operationId": "List",
|
|
25
|
+
"description": "",
|
|
26
|
+
"tags": [],
|
|
27
|
+
"parameters": [],
|
|
28
|
+
"consumes": []
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"/items": {
|
|
32
|
+
"get": {
|
|
33
|
+
"responses": {
|
|
34
|
+
"200": {
|
|
35
|
+
"description": "OK",
|
|
36
|
+
"headers": {},
|
|
37
|
+
"examples": {}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"summary": "List_2",
|
|
41
|
+
"operationId": "List_2",
|
|
42
|
+
"description": "",
|
|
43
|
+
"tags": [],
|
|
44
|
+
"parameters": [],
|
|
45
|
+
"consumes": []
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"/products": {
|
|
49
|
+
"get": {
|
|
50
|
+
"responses": {
|
|
51
|
+
"200": {
|
|
52
|
+
"description": "OK",
|
|
53
|
+
"headers": {},
|
|
54
|
+
"examples": {}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"summary": "List",
|
|
58
|
+
"operationId": "List_3",
|
|
59
|
+
"description": "",
|
|
60
|
+
"tags": [],
|
|
61
|
+
"parameters": [],
|
|
62
|
+
"consumes": []
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"definitions": {
|
|
67
|
+
"Users": {},
|
|
68
|
+
"Items": {},
|
|
69
|
+
"Products": {}
|
|
70
|
+
},
|
|
71
|
+
"securityDefinitions": {},
|
|
72
|
+
"tags": []
|
|
73
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.3",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": ""
|
|
7
|
+
},
|
|
8
|
+
"servers": [
|
|
9
|
+
{
|
|
10
|
+
"url": "http://127.0.0.1/api/v1"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"paths": {
|
|
14
|
+
"/extensions": {
|
|
15
|
+
"get": {
|
|
16
|
+
"responses": {
|
|
17
|
+
"200": {
|
|
18
|
+
"description": "OK",
|
|
19
|
+
"headers": {},
|
|
20
|
+
"content": {
|
|
21
|
+
"application/json": {
|
|
22
|
+
"schema": {
|
|
23
|
+
"title": "",
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"id": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"example": {
|
|
32
|
+
"id": ""
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"summary": "Get extensions",
|
|
39
|
+
"operationId": "Get extensions",
|
|
40
|
+
"description": "",
|
|
41
|
+
"tags": [
|
|
42
|
+
"Extensions"
|
|
43
|
+
],
|
|
44
|
+
"parameters": []
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"components": {
|
|
49
|
+
"schemas": {
|
|
50
|
+
"Extension": {
|
|
51
|
+
"$ref": "#/components/schemas/Foo type"
|
|
52
|
+
},
|
|
53
|
+
"Foo type": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"id": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"description": "the id"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"tags": [
|
|
65
|
+
{
|
|
66
|
+
"name": "Extensions"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.3",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": ""
|
|
7
|
+
},
|
|
8
|
+
"servers": [
|
|
9
|
+
{
|
|
10
|
+
"url": "http://127.0.0.1/api/v1"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"paths": {
|
|
14
|
+
"/extensions": {
|
|
15
|
+
"get": {
|
|
16
|
+
"responses": {
|
|
17
|
+
"200": {
|
|
18
|
+
"description": "OK",
|
|
19
|
+
"headers": {},
|
|
20
|
+
"content": {
|
|
21
|
+
"application/json": {
|
|
22
|
+
"schema": {
|
|
23
|
+
"$ref": "#/components/schemas/Extension"
|
|
24
|
+
},
|
|
25
|
+
"example": {
|
|
26
|
+
"id": ""
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"summary": "Get extensions",
|
|
33
|
+
"operationId": "Get extensions",
|
|
34
|
+
"description": "",
|
|
35
|
+
"tags": [
|
|
36
|
+
"Extensions"
|
|
37
|
+
],
|
|
38
|
+
"parameters": []
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"components": {
|
|
43
|
+
"schemas": {
|
|
44
|
+
"Extension": {
|
|
45
|
+
"$ref": "#/components/schemas/Foo type"
|
|
46
|
+
},
|
|
47
|
+
"Foo type": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"properties": {
|
|
50
|
+
"id": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "the id"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"tags": [
|
|
59
|
+
{
|
|
60
|
+
"name": "Extensions"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.3",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "My Title",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": "This is some blueprint"
|
|
7
|
+
},
|
|
8
|
+
"servers": [
|
|
9
|
+
{
|
|
10
|
+
"url": "http://example.org"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"paths": {
|
|
14
|
+
"/some/url": {
|
|
15
|
+
"put": {
|
|
16
|
+
"responses": {
|
|
17
|
+
"200": {
|
|
18
|
+
"description": "OK",
|
|
19
|
+
"headers": {},
|
|
20
|
+
"content": {
|
|
21
|
+
"application/json": {
|
|
22
|
+
"schema": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"properties": {}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"summary": "Some super awesome endpoint",
|
|
31
|
+
"operationId": "Some super awesome endpoint",
|
|
32
|
+
"description": "",
|
|
33
|
+
"tags": [
|
|
34
|
+
"A Group"
|
|
35
|
+
],
|
|
36
|
+
"parameters": [],
|
|
37
|
+
"requestBody": {
|
|
38
|
+
"content": {
|
|
39
|
+
"application/json": {
|
|
40
|
+
"schema": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"properties": {}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"components": {
|
|
51
|
+
"schemas": {}
|
|
52
|
+
},
|
|
53
|
+
"tags": [
|
|
54
|
+
{
|
|
55
|
+
"name": "A Group"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.3",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "My Title",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": "This is some blueprint"
|
|
7
|
+
},
|
|
8
|
+
"servers": [
|
|
9
|
+
{
|
|
10
|
+
"url": "http://example.org"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"paths": {
|
|
14
|
+
"/some/url": {
|
|
15
|
+
"put": {
|
|
16
|
+
"responses": {
|
|
17
|
+
"200": {
|
|
18
|
+
"description": "OK",
|
|
19
|
+
"headers": {},
|
|
20
|
+
"content": {
|
|
21
|
+
"application/json": {
|
|
22
|
+
"schema": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"properties": {}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"summary": "Some super awesome endpoint",
|
|
31
|
+
"operationId": "Some super awesome endpoint",
|
|
32
|
+
"description": "",
|
|
33
|
+
"tags": [
|
|
34
|
+
"A Group"
|
|
35
|
+
],
|
|
36
|
+
"parameters": [],
|
|
37
|
+
"requestBody": {
|
|
38
|
+
"content": {
|
|
39
|
+
"application/json": {
|
|
40
|
+
"schema": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"properties": {}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"components": {
|
|
51
|
+
"schemas": {}
|
|
52
|
+
},
|
|
53
|
+
"tags": [
|
|
54
|
+
{
|
|
55
|
+
"name": "A Group"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
"summary": "Some resource",
|
|
116
|
-
"operationId": "Some
|
|
116
|
+
"operationId": "Some resource_2",
|
|
117
117
|
"description": "",
|
|
118
118
|
"tags": [],
|
|
119
119
|
"parameters": [],
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
}
|
|
166
166
|
},
|
|
167
167
|
"summary": "Some resource",
|
|
168
|
-
"operationId": "Some
|
|
168
|
+
"operationId": "Some resource_3",
|
|
169
169
|
"description": "",
|
|
170
170
|
"tags": [],
|
|
171
171
|
"parameters": []
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
"summary": "Some resource",
|
|
101
|
-
"operationId": "Some
|
|
101
|
+
"operationId": "Some resource_2",
|
|
102
102
|
"description": "",
|
|
103
103
|
"tags": [],
|
|
104
104
|
"parameters": [],
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
}
|
|
141
141
|
},
|
|
142
142
|
"summary": "Some resource",
|
|
143
|
-
"operationId": "Some
|
|
143
|
+
"operationId": "Some resource_3",
|
|
144
144
|
"description": "",
|
|
145
145
|
"tags": [],
|
|
146
146
|
"parameters": []
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
}
|
|
166
166
|
},
|
|
167
167
|
"summary": "Some resource",
|
|
168
|
-
"operationId": "Some
|
|
168
|
+
"operationId": "Some resource_2",
|
|
169
169
|
"description": "",
|
|
170
170
|
"tags": [],
|
|
171
171
|
"parameters": [],
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
}
|
|
212
212
|
},
|
|
213
213
|
"summary": "Some resource",
|
|
214
|
-
"operationId": "Some
|
|
214
|
+
"operationId": "Some resource_3",
|
|
215
215
|
"description": "",
|
|
216
216
|
"tags": [],
|
|
217
217
|
"parameters": [],
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
}
|
|
237
237
|
},
|
|
238
238
|
"summary": "Some resource",
|
|
239
|
-
"operationId": "Some
|
|
239
|
+
"operationId": "Some resource_4",
|
|
240
240
|
"description": "",
|
|
241
241
|
"tags": [],
|
|
242
242
|
"parameters": [],
|
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
}
|
|
287
287
|
},
|
|
288
288
|
"summary": "Some resource",
|
|
289
|
-
"operationId": "Some
|
|
289
|
+
"operationId": "Some resource_5",
|
|
290
290
|
"description": "",
|
|
291
291
|
"tags": [],
|
|
292
292
|
"parameters": [],
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
}
|
|
166
166
|
},
|
|
167
167
|
"summary": "Some resource",
|
|
168
|
-
"operationId": "Some
|
|
168
|
+
"operationId": "Some resource_2",
|
|
169
169
|
"description": "",
|
|
170
170
|
"tags": [],
|
|
171
171
|
"parameters": [],
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
}
|
|
207
207
|
},
|
|
208
208
|
"summary": "Some resource",
|
|
209
|
-
"operationId": "Some
|
|
209
|
+
"operationId": "Some resource_3",
|
|
210
210
|
"description": "",
|
|
211
211
|
"tags": [],
|
|
212
212
|
"parameters": [],
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
}
|
|
232
232
|
},
|
|
233
233
|
"summary": "Some resource",
|
|
234
|
-
"operationId": "Some
|
|
234
|
+
"operationId": "Some resource_4",
|
|
235
235
|
"description": "",
|
|
236
236
|
"tags": [],
|
|
237
237
|
"parameters": [],
|
|
@@ -281,7 +281,7 @@
|
|
|
281
281
|
}
|
|
282
282
|
},
|
|
283
283
|
"summary": "Some resource",
|
|
284
|
-
"operationId": "Some
|
|
284
|
+
"operationId": "Some resource_5",
|
|
285
285
|
"description": "",
|
|
286
286
|
"tags": [],
|
|
287
287
|
"parameters": [],
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
"summary": "Some resource",
|
|
154
|
-
"operationId": "Some
|
|
154
|
+
"operationId": "Some resource_2",
|
|
155
155
|
"description": "",
|
|
156
156
|
"tags": [],
|
|
157
157
|
"parameters": []
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
}
|
|
208
208
|
},
|
|
209
209
|
"summary": "Some resource",
|
|
210
|
-
"operationId": "Some
|
|
210
|
+
"operationId": "Some resource_3",
|
|
211
211
|
"description": "",
|
|
212
212
|
"tags": [],
|
|
213
213
|
"parameters": []
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
"summary": "Some resource",
|
|
154
|
-
"operationId": "Some
|
|
154
|
+
"operationId": "Some resource_2",
|
|
155
155
|
"description": "",
|
|
156
156
|
"tags": [],
|
|
157
157
|
"parameters": []
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
199
|
"summary": "Some resource",
|
|
200
|
-
"operationId": "Some
|
|
200
|
+
"operationId": "Some resource_3",
|
|
201
201
|
"description": "",
|
|
202
202
|
"tags": [],
|
|
203
203
|
"parameters": []
|
package/test/output/Schema.json
CHANGED
package/test/test.js
CHANGED
|
@@ -46,7 +46,9 @@ var remote = 'https://raw.githubusercontent.com/apiaryio/api-blueprint/format-1A
|
|
|
46
46
|
'Issue-#36.md',
|
|
47
47
|
'Issue-#38.md',
|
|
48
48
|
'Issue-#49.md',
|
|
49
|
+
'Issue-#50.md',
|
|
49
50
|
'Issue-#57.md',
|
|
51
|
+
'Issue-#72.md',
|
|
50
52
|
'apiblueprint_uber.md',
|
|
51
53
|
'apiblueprint_valid_simple.md',
|
|
52
54
|
'schema_without_body.md',
|
|
@@ -56,7 +58,9 @@ var remote = 'https://raw.githubusercontent.com/apiaryio/api-blueprint/format-1A
|
|
|
56
58
|
'OpenAPI3_includes.md',
|
|
57
59
|
'OpenAPI3_attributes.md',
|
|
58
60
|
'OpenAPI3_Issue-#58.md',
|
|
59
|
-
'OpenAPI3_Issue-#66.md'
|
|
61
|
+
'OpenAPI3_Issue-#66.md',
|
|
62
|
+
'OpenAPI3_Issue-#73.md',
|
|
63
|
+
'OpenAPI3_Issue-#79.md'
|
|
60
64
|
];
|
|
61
65
|
|
|
62
66
|
var fetch = function (file) {
|