mulesoft / api-console

An interactive REST console based on RAML/OAS files
Other
911 stars 237 forks source link

Semantic deep linking URLs #498

Closed ambrussimon closed 4 years ago

ambrussimon commented 7 years ago

By default api-console keeps track of the current location using a simple numbering scheme, for example: resources-0-methods-0 in https://mulesoft.github.io/api-console/#/docs/resources-0-methods-0

Is there a way to have these deep linking URLs use a different scheme, based on the resource name in case of resources for example?

jarrodek commented 7 years ago

Hi,

No, this is not implemented to the console and most probably won't be. This kind of routing is quite complex and I don't see additional value in implementing it n the console. Also this would add additional computation when any part of application path (the URL) changes. It would need to parse url, match params with path and then update path. And the other way around when path change to reflect this change to the URL. It already makes a lot of computation and right now I'm focusing on how to reduce number of computations when you change the path instead of adding new ones.

You however, could code such functionality in your version of the app quite easily. Our demo app contains an example of routing for the console: https://github.com/mulesoft/api-console/blob/master/demo/app.js Very similar code is used in our build tools templates when you are building the console. Having your version of the console you'll be able to still use the same build tools pointing them to your custom build.

If you decide to do it, pleas, let me know how it works for you. I'll be discussing this issue during the next performance meeting but to be fair I do't think that we'll change this behavior soon.

jarrodek commented 4 years ago

Support for semantic links in the console is only possible in standalone application. The app would have to come up with some kind of custom router that is able to generate canonical "id" from AMF model selection. This would use "displayName" property transformed to a slug to build the path with a fallback option to regular ids.

This to be implemented in the <api-console-app> component demo page as an example of implementation and then in APIC's docker image.

I am adding this to the roadmap.

jarrodek commented 4 years ago

The console as a web component won't support this. The application can but it requires implementation on the hosting application side.