Skip to content

Commit

Permalink
Merge pull request #211 from swisspost/develop
Browse files Browse the repository at this point in the history
Release 0.9.34
  • Loading branch information
lbovet authored Jan 24, 2023
2 parents 18256a0 + d0e80fa commit a1e1c4c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apikana",
"version": "0.9.33",
"version": "0.9.34",
"description": "Integrated tools for REST API design - アピ",
"main": "index.js",
"bin": {
Expand Down
11 changes: 11 additions & 0 deletions src/generate-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
log.info('Found definition', colors.magenta(name));
var schema = schemas[name];
var v3 = handleAllOf(schema);
unquoteEnumValues(schema);
removeDefinitions(schema);
replaceLocalRef(schema);
replaceLocalRef(v3);
Expand Down Expand Up @@ -154,6 +155,16 @@ module.exports = {
}
}

function unquoteEnumValues(schema) {
if (schema.enum) {
schema.enum = schema.enum.map(v => v
.replace(/^"/, "")
.replace(/^'/, "")
.replace(/"$/, "")
.replace(/'$/, ""));
}
}

function removeDefinitions(schema) {
for (var type in schema.definitions) {
var info = schemaInfos[type];
Expand Down

0 comments on commit a1e1c4c

Please sign in to comment.