nelmio / NelmioApiDocBundle

Generates documentation for your REST API from annotations
MIT License
2.22k stars 834 forks source link

Bug in ApiPlatformDescriber #1493

Open helmut-hoffer-von-ankershoffen opened 5 years ago

helmut-hoffer-von-ankershoffen commented 5 years ago

Documentation gathered via the ApiPlatformDescriber does not respect areas or path constraints

Is this a known issue and is there a workaround?

GuilhemN commented 5 years ago

It's not really a bug actually, it is due to how api-platform is supported : we merge the documentation api-platform generates and we don't modify it directly.

I'm not sure it's possible to improve this point as we can't alter their docs generation without duplicating a lot of code from their repository.

Destroy666x commented 5 years ago

How is that not a bug? It's even worse because it makes the bundle unusable without some own code to somehow get around that if you don't want useless or even sensitive data displayed to user. There isn't even a way to turn off API Platform merge, is there? Only with compiler pass I guess

habashyjr commented 2 years ago

@GuilhemN Any suggestions/workarounds here? or it's only to totally disable api-plaform docs and write our own OA docs

chrisguitarguy commented 2 years ago

Little more context, from what I understand: @Area annotation/attributes are not respect nor is any path filtering done that would be defined in the areas config for nelmio_api_doc.

I don't know what the right solution is here as API Platform itself has OpenAPI support: https://api-platform.com/docs/core/openapi/ with some suggestions on how one can modify it.

GuilhemN commented 2 years ago

Thanks for the ref! It seems a lot has changed in ApiPlatform since I created this bundle.

From what I see to achieve the desired result we would need to hook into https://github.com/api-platform/core/blob/main/src/OpenApi/Factory/OpenApiFactory.php#L136, this is not feasible directly, so I see two solutions: