Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ease group declaration through code or properties with actuators #1651

Conversation

christophejan
Copy link

Ease group declaration through code or properties with actuators by making actuator customizers global.

That way, actuator may be used the same way they already are on Default OpenAPI description.

springdoc:
  show-actuator: true
  group-configs:
    - group: all
      paths-to-match: /**
    - group: person
      paths-to-match: /person/**
    - group: x-actuator
      paths-to-match: ${management.endpoints.web.base-path:/actuator}/**
@Bean
public GroupedOpenApi allGroupedOpenApi() {
	return GroupedOpenApi.builder()
		.group("all")
		.pathsToMatch("/**")
		.build();
	}
}
@Bean
public GroupedOpenApi personGroupedOpenApi() {
	return GroupedOpenApi.builder()
		.group("person")
		.pathsToMatch("/person/**")
		.build();
	}
}
@Bean
public GroupedOpenApi xActuatorGroupedOpenApi(WebEndpointProperties endpointProperties) {
	return GroupedOpenApi.builder()
		.group(Constants.ACTUATOR_DEFAULT_GROUP)
		.pathsToMatch(endpointProperties.getBasePath() + Constants.ALL_PATTERN)
		.build();
	}
}

The PR is composed by 2 commits that are more easy to review one by one :

  1. Ease group declaration through code or properties with actuators (Global actuator customizers)
  2. Switch from statefull to stateless actuator customizers (otherwise, operationId depends on the order in which groups are requested). Actuator operation ids should be unique across each OpenAPI definition not across all OpenAPI definitions. Statefull cutomizer beans seems odd.

- Actuator operation ids should be unique across each OpenAPI definition
not across all OpenAPI definitions
- Statefull cutomizer beans seems odd
@bnasslahsen bnasslahsen merged commit c4dfd04 into springdoc:master May 23, 2022
@bnasslahsen
Copy link
Contributor

Thank you @christophejan for your PR!

bnasslahsen added a commit that referenced this pull request May 23, 2022
@christophejan christophejan deleted the ease-group-declaration-with-actuators branch June 3, 2022 16:50
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.

None yet

2 participants