42Crunch / vscode-openapi

VisualStudio Code OpenAPI tools
GNU Affero General Public License v3.0
335 stars 41 forks source link

Cmd+Click to navigate to source code method mentioned in `operationId` #277

Open kavishdahekar-sap opened 3 months ago

kavishdahekar-sap commented 3 months ago

Usually OpenAPI spec and source code is maintained in the same repository. It would be a great feature to be able to Cmd+Click the operationId of an API endpoint and have VSCode navigate to that method.

I am willing to take this up if you think this is a worthwhile feature.

ak1394 commented 3 months ago

Hi @kavishdahekar-sap This is sounds like an interesting feature to have! It would be pretty challenging to try to locate matching code, given that implementation could be in any language and framework? How do you plan to tackle this problem?

kavishdahekar commented 3 months ago

I was actually just thinking about Python+Connexion where Connexion implicitly links the endpoint to the operation via Flask under the hood. The operationId can be exactly matched to the packages down to the method name.

Since OpenAPI just enforces the operationId to be a unique string and it doesn't necessarily have to be associated with its implementation code, we could probably just start with Python+Connexion for now and either disable the feature for other cases or just trigger a search for all references of the operationId in the workspace on Cmd+Click.

ak1394 commented 3 months ago

This seems pretty limited solution, IMO...

kavishdahekar commented 2 months ago

That's a fair conclusion, however, it's often not feasible to support all languages for a new feature right from the start. By starting with Python, we can implement and refine the feature, setting a foundation for further development. This will also allow us to gather feedback and make iterative improvements. Ideally, as the feature proves its value and stability, other contributors from the community can help extend its support to additional languages over time.