How to apply the Umbraco schema and operation IDs for custom Management APIs
All core Management APIs have a custom scheme for their generated OpenAPI schema and operation IDs.
This scheme is strictly opt-in to avoid affecting custom APIs by default. In this article, we'll see how to opt-in to the scheme.
If you are happy with your APIs' default schema and operation IDs, nothing is likely gained by using the Umbraco ones.
Schema IDs are handled by ISchemaIdHandler
implementations. To opt-in to the Umbraco schema IDs, we base our implementation on the core handler:
Then, we implement a composer to register the new schema ID handler:
Operation IDs follow the same pattern as schema IDs. The only difference is that the IOperationIdHandler
operates at the API level, not at the type level.
Again, to opt-in to the Umbraco operation IDs, we base our implementation on the core handler:
Then, we implement a composer to register the new operation ID handler: