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

"No API definition provided." when using swagger-config-file #156

Closed
RemiBardon opened this issue Mar 9, 2021 · 0 comments · Fixed by #157
Closed

"No API definition provided." when using swagger-config-file #156

RemiBardon opened this issue Mar 9, 2021 · 0 comments · Fixed by #157

Comments

@RemiBardon
Copy link
Contributor

RemiBardon commented Mar 9, 2021

When providing a swagger-config-file (for example swagger-config.yaml), it's copied as a swagger-config file (without an extension). This file is then used by SwaggerUIBundle in index.html:

// Begin Swagger UI call region
const ui = SwaggerUIBundle({
    configUrl: "swagger-config",
    dom_id: '#swagger-ui'
})
// End Swagger UI call region

(I think) the problem is that when Swagger UI reads the configuration file, it doesn't know what format it's written in (see the documentation about Swagger UI parameters. The resulting Swagger UI is a blank page with "No API definition provided.".

A solution would be to use

const swaggerConfigFileName = basename(config.swaggerConfigFile);
io.cp(
    config.swaggerConfigFile,
    join(config.outputPath, swaggerConfigFileName)
);
return swaggerConfigFileName;

instead of

io.cp(
    config.swaggerConfigFile,
    join(config.outputPath, 'swagger-config')
);
return 'swagger-config';

in swagger-ui-action.ts#L66.

RemiBardon added a commit to RemiBardon/swagger-ui-action that referenced this issue Mar 9, 2021
@RemiBardon RemiBardon mentioned this issue Mar 9, 2021
RemiBardon added a commit to RemiBardon/swagger-ui-action that referenced this issue Mar 11, 2021
Legion2 added a commit that referenced this issue Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant