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

Add lazy quantifier to aspectResourcePath regex (maven plugin config property); fixes #399 #401

Merged
merged 2 commits into from
Jul 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ private ObjectNode getPropertiesNode( final Optional<String> resourcePath, final
}

if ( resourcePath.isPresent() ) {
final List<String> dynamicParameters = Pattern.compile( "[{]\\S+[}]" ).matcher( resourcePath.get() ).results()
.map( match -> match.group( 0 ) ).collect( Collectors.toList() );
if ( !dynamicParameters.isEmpty() && !jsonProperties.isPresent() ) {
final List<String> dynamicParameters = Pattern.compile( "[{]\\S+?[}]" ).matcher( resourcePath.get() ).results()
.map( match -> match.group( 0 ) ).toList();
if ( !dynamicParameters.isEmpty() && jsonProperties.isEmpty() ) {
final String errorString = String
.format( "Resource path contains properties %s, but has no properties map.", dynamicParameters );
LOG.error( errorString );
Expand Down Expand Up @@ -252,13 +252,13 @@ private void setOptionalSchemas( final Aspect aspect, final boolean includeQuery
final ObjectNode schemas = (ObjectNode) rootNode.get( FIELD_COMPONENTS ).get( FIELD_SCHEMAS );
if ( includeQueryApi ) {
final InputStream inputStream = getClass().getResourceAsStream( "/openapi/Filter.json" );
final String string = IOUtils.toString( inputStream, StandardCharsets.UTF_8.name() );
final String string = IOUtils.toString( inputStream, StandardCharsets.UTF_8 );
final ObjectNode filterNode = (ObjectNode) objectMapper.readTree( string );
schemas.set( FIELD_FILTER, filterNode );
}
if ( !aspect.getOperations().isEmpty() ) {
final InputStream inputStream = getClass().getResourceAsStream( "/openapi/JsonRPC.json" );
final String string = IOUtils.toString( inputStream, StandardCharsets.UTF_8.name() );
final String string = IOUtils.toString( inputStream, StandardCharsets.UTF_8 );
final ObjectNode filterNode = (ObjectNode) objectMapper.readTree( string );
schemas.set( FIELD_RPC, filterNode );
}
Expand Down
Loading