Documentation leads me to believe all UmbracoApiControllers will just "show up" in Swagger #16895
Replies: 2 comments
-
Hey @markadrake I can add some insight here. Umbraco uses the So works something like this: Your project --> Reference to Umbraco --> Umbraco registers Therefore as you pointed out you need the But you will also notice that if you create a minimal API endpoint Example this also wouldn't be picked up in Swagger. This is because Umbraco is missing a call to That's my understanding of how it works at least hope it helps answer your question. |
Beta Was this translation helpful? Give feedback.
-
Just starting to look at this general topic of implementing a custom REST API, and note that UmbracoApiController was obsoleted in v14 and removed in v15. The recommended solution is to implement a native Controller, but (and without giving it much investigation) I'm wondering if/how it might be possible to implement custom REST APIs using the DotNet Minimal API model ? |
Beta Was this translation helpful? Give feedback.
-
Link to Umbraco Documentation:
I followed the instructions to create my own API controllers. It's not something I often do so I prefer to have the latest and greatest documentation open at all times. I was under the impression that any
UmbracoApiController
class not mapped to a specific Swagger document would be magically included on the list. But that's not so.If you do not attribute your
UmbracoApiController
class with[ApiController]
, and the mandatory[Route()]
, your controller and methods will not show up in Swagger. Maybe everyone knows this, but I feel like the documentation should be written to a level that following the examples will just work.I'm starting this as a discussion because my comfort level with C# and backend programming isn't enough to "know that I'm right".
All I do know is that Swagger did not care for my API endpoint(s) until they were annotated.
Beta Was this translation helpful? Give feedback.
All reactions