Skip to content

Update API controllers and OpenAPI config for Clean Starter#471

Merged
prjseal merged 3 commits into
prjseal:mainfrom
suedeapple:fix/headless-18-updates
Jul 2, 2026
Merged

Update API controllers and OpenAPI config for Clean Starter#471
prjseal merged 3 commits into
prjseal:mainfrom
suedeapple:fix/headless-18-updates

Conversation

@suedeapple

Copy link
Copy Markdown
Contributor
  • Hide PackageController from API explorer
    Avoids it appearing in Swagger UI /umbraco/openapi

  • Remove TestController and its implementation
    Not used, removed to clear out files not needed

  • Add [Tags] and MapToApi attributes to Contact, Dictionary, and Search controllers for improved OpenAPI grouping.
    This is required so nextjs can discover the custom api endpoints

  • Restrict OpenAPI doc to controllers with MapToApi("clean-starter")

- Hide PackageController from API explorer
- Remove TestController and its implementation
- Add [Tags] and MapToApi attributes to Contact, Dictionary, and Search controllers for improved OpenAPI grouping
- Restrict OpenAPI doc to controllers with MapToApi("clean-starter")
Add Delivery API schema config note for Umbraco 18+ with example. Clarify OpenAPI/Swagger endpoint paths for different Umbraco versions. Improve and relocate Next.js revalidation config section with updated guidance.
@prjseal

prjseal commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Hi @suedeapple thanks for the PR. Why do we need to hide the package controller? I am using it for generating the package xml and I think it is useful to see in swagger. Would be interested in why you think we should hide it, in case I’ve missed something.

@suedeapple

suedeapple commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@prjseal

In v18, before this PR - non of the [MapToApi("clean-starter")] end points appeared in the Swagger UI, as the code was missing this bit of the puzzle.....

template/Clean.Headless/Startup/CleanStarterOpenApiExtensions.cs


    // Include DictoryApiV1Controller,  SearchApiV1Controller and ContactApiV1Controller in the OpenAPI document
            options.ShouldInclude = apiDescription =>
                apiDescription.ActionDescriptor is ControllerActionDescriptor controllerActionDescriptor
                && controllerActionDescriptor.EndpointMetadata
                    .OfType<MapToApiAttribute>()
                    .Any(attribute => attribute.ApiName == DocumentName);

It depends if you want the Package endpoint to appear in the Swagger UI, and have it there to "test execute" it. Or whether this is merely an internal "admin" endpoint to package up all the content, and not something that should be easily be made visible.

[ApiExplorerSettings(GroupName = "Package", IgnoreApi = true)] this just removes it from the Swagger UI, and dosent break the endpoint.

It's up to you really - Just a preference

@prjseal
prjseal merged commit d9afb73 into prjseal:main Jul 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants