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
Not able to access endpoints for openapi.json and swagger.json #10734
Comments
Hello, please follow the issue template. A proper issue submission let's us better understand the origin of your bug and therefore help you. I will reopen your issue when we receive the issue following the template guidelines and properly fill out the template. You can see the template guidelines for bug reports here. Please update the issue with the template and we can reopen this report. Thank you. |
Hello, I have updated the issue following the template. |
Please can we reopen this? Have the same issue now. |
Is this an existing issue? |
Yes, it is. |
Is there any resolution or any workaround for it currently |
I can confirm this issue. I have enabled all role permissions for documentation plugs but Nothing happened, I am still getting 404 error during enetring http://localhost:1337/documentation/v1.0.0/openapi.json or http://localhost:1337/documentation/openapi.json. I am afraid that the docs are outdated as I am not able to access those json files ( I think workaround for it is implementation of own custom controller that returns |
It currently seems that the only way to serve the json file as of right now, is through a custom controller. I can try to create a pull request for it later. Here is how to go about it: In
In the
You should now be able to access |
I have just created a similar workaround to @MarkKragerup solution but I implemented two endpoints as I wanted to use documentation's version as param. You would also need to send authorization header (use JWT token as Bearer) to access above endpoints.
It should work. |
There is a pending PR on this issue - and a merged documentation PR. This explains why the documentation is incorrectly claiming it works - the base PR needs merging. Base PR: Doc PR: |
I'm using Strapi v4.1.12 and the documentation plugin in v4.2.2. There is no way to access any of these:
Any ideas how to make it work? |
This is what I did: Add
Add
Add
Hopefully this helps somebody, would like to see these routes in the plugin though... |
It's not directly related to the bug, but if you work on monorepo including both the app and the strapi, you can make a workaround like this input: path.resolve(process.cwd(), '../admin/src/extensions/documentation/documentation/1.0.0/full_documentation.json'), |
Thank you @roelbeerens ! Anyway, I have a problem, probably not related to your solution : my components do not have their "required" info. |
The problem has not been fixed in newer versions. The solution was the instruction roelbeerens. Thanks for your help! |
Hello, In order to keep our GitHub issues clean and only related to bug reports I've moved your enhancement / feature requested over to our feedback database. You can find your request here: https://feedback.strapi.io/developer-experience/p/not-able-to-access-endpoints-for-openapijson-and-swaggerjson Thanks! |
+1 |
If your frontend project is beside to your strapi files a good alternative to read the the file directly from the filesystem, for example: |
In typescript this solution doesn't work because the package |
Bug report
Not able to access endpoints for openapi.json and swagger.json
I am deploying Strapi v3.6.6 from my local (windows 2019 vm) to Azure App Service using Azure DevOps
I want to use the openapi spec endpoint to setup Strapi APIs in Azure API Management. These internal APIs will then be used by an Azure Static Web App frontend.
Before Setting up APIs in Azure API Management, I want to view the openapi.json and swagger.json through 'Public' role and then I will setup authentication for APIs
But I am not able to access endpoints for openapi.json and swagger.json from localhost.
I am only able to setup APIs in API manager by manually uploading the file full_documentation.json. I want to use the endpoint as it will always give the updated/ regenerated json whenever model is updated.
Steps to reproduce the behavior
As per documentation https://strapi.io/documentation/developer-docs/latest/development/plugins/documentation.html#swagger-json-and-openapi-json-files
the openapi.json and swagger.json should be accessible. But when I try the url on localhost
http://localhost:1337/documentation/v1.0.0/openapi.json
I get a 404-not found error.
I do not see any permissions to set under setting-> users and permissions plugins -> roles -> public.
Expected behavior
As per Strapi Documentation as given below it should be accessible.
If the default /documentation base URL is used, the endpoints exposed are:
Screenshots
Code snippets
System
Additional context
Am I missing something?
Is this a bug?
Can you give an example how to access the endpoints for openapi.json and swagger.json.
The text was updated successfully, but these errors were encountered: