You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While going through the github source code I noticed the SpringDocSpecPropertiesConfiguration and SpecPropertiesCustomizer which state:
Allows externalizing strings in generated openapi schema via properties that follow conventional naming similar or identical to openapi schema
To set value of a string in schema, define an application property that matches the target node with springdoc.spec-properties prefix.
Sample supported properties for api-info customization:
springdoc.spec-properties.info.title - to set title of api-info springdoc.spec-properties.info.description - to set description of api-info springdoc.spec-properties.info.version - to set version of api-info
This seemed quite useful as I'm doing that now in a custom OpenApiCustomizer.
I gave it a try but unfortunately it was not working...
Debugging a bit, the SpringDocSpecPropertiesConfiguration itself is created as uncondionalClass but it's beans are never created.
@Lazy(false)
@Configuration(proxyBeanMethods = false)
@ConditionalOnBean(SpringDocConfiguration.class)
@Conditional(SpecPropertiesCondition.class)
public class SpringDocSpecPropertiesConfiguration {
The SpecPropertiesCondition seems to return false...
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
final BindResult<SpringDocConfigProperties> result = Binder.get(context.getEnvironment())
.bind(SPRINGDOC_PREFIX, SpringDocConfigProperties.class);
if (result.isBound()) {
SpringDocConfigProperties springDocConfigProperties = result.get();
if (springDocConfigProperties.getOpenApi() != null)
return true;
Set<GroupConfig> groupConfigs = springDocConfigProperties.getGroupConfigs();
return groupConfigs.stream().anyMatch(config -> config.getOpenApi() != null);
}
return false;
}
The springDocConfigProperties.getOpenApi() is null...
and as I have no groups also the later statement will not match.
Is this supposed to work, and if so how?
The text was updated successfully, but these errors were encountered:
marceloverdijk
changed the title
Is SpringDocSpecPropertiesConfiguration supported
Is SpringDocSpecPropertiesConfiguration supported?
May 12, 2025
springdoc.OpenApi.info.title=My API
springdoc.OpenApi.info.description=My Springdoc API
springdoc.OpenApi.info.version=1.0
springdoc.OpenApi.info.contact.name=Me
[email protected]
springdoc.OpenApi.info.contact.url=https://exmple.com
springdoc.OpenApi.info.extensions[x-logo].url=https://avatars.githubusercontent.com?s=300
springdoc.OpenApi.info.extensions[x-logo].altText=My API Logo
won't work. Or at least is not in the rendered openapi spec.
However while debugging, it is in the SpringDocConfigProperties
generated openapi spec (missing the x-logo extension):
While going through the github source code I noticed the
SpringDocSpecPropertiesConfiguration
andSpecPropertiesCustomizer
which state:This seemed quite useful as I'm doing that now in a custom OpenApiCustomizer.
However the springdocs docs say nothing about this in https://springdoc.org/#properties
I gave it a try but unfortunately it was not working...
Debugging a bit, the
SpringDocSpecPropertiesConfiguration
itself is created asuncondionalClass
but it's beans are never created.The
SpecPropertiesCondition
seems to return false...The
springDocConfigProperties.getOpenApi()
isnull
...and as I have no groups also the later statement will not match.
Is this supposed to work, and if so how?
The text was updated successfully, but these errors were encountered: