Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenAPI3 migration. Paths section #125

Closed
3 of 5 tasks
yarax opened this issue May 13, 2019 · 2 comments
Closed
3 of 5 tasks

OpenAPI3 migration. Paths section #125

yarax opened this issue May 13, 2019 · 2 comments
Labels

Comments

@yarax
Copy link
Owner

yarax commented May 13, 2019

@yarax yarax added the openapi3 label May 13, 2019
@0xR
Copy link
Collaborator

0xR commented May 18, 2019

The servers section is already supported and under test:

export const getServerPath = (schema: SwaggerSchema) => {
const server =
schema.servers && Array.isArray(schema.servers)
? schema.servers[0]
: schema.host
? [
(schema.schemes && schema.schemes[0]) || 'http',
'://',
schema.host,
schema.basePath,
]
.filter(Boolean)
.join('')
: undefined;
if (!server) {
return undefined;
}
if (typeof server === 'string') {
return server;
}
const { url, variables } = server;
return variables
? Object.keys(server.variables).reduce((acc, variableName) => {
const variable = server.variables[variableName];
const value =
typeof variable === 'string'
? variable
: variable.default || variable.enum[0];
return acc.replace(`{${variableName}}`, value);
}, url)
: url;
};

@0xR
Copy link
Collaborator

0xR commented Aug 19, 2019

The basic support for openapi 3 and its path sections has been released in #143
#66 and #60 are enhancements that can be picked up later.

@0xR 0xR closed this as completed Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants