Skip to content

Commit

Permalink
remove clean openapi specs script
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixTJDietrich committed Oct 26, 2024
1 parent 8ddfcc5 commit aa39217
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 28 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
],
"scripts": {
"generate:api:clean": "rimraf webapp/src/app/core/modules/openapi",
"generate:api:application-server-specs": "cd server/application-server && mvn verify -DskipTests=true && node ../../scripts/clean-openapi-specs.js",
"generate:api:application-server-specs": "cd server/application-server && mvn verify -DskipTests=true",
"generate:api:application-server-client": "npx openapi-generator-cli generate -i server/application-server/openapi.yaml -g typescript-angular -o webapp/src/app/core/modules/openapi --additional-properties fileNaming=kebab-case,withInterfaces=true --generate-alias-as-model",
"generate:api": "npm run generate:api:application-server-specs && npm run generate:api:clean && npm run generate:api:application-server-client"
},
Expand Down
25 changes: 0 additions & 25 deletions scripts/clean-openapi-specs.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class OpenAPIConfiguration {

@Bean
public OpenApiCustomizer schemaCustomizer() {
return openApi -> {
return openApi -> {
var components = openApi.getComponents();

// Only include schemas with DTO suffix and remove the suffix
Expand Down Expand Up @@ -69,11 +69,11 @@ public OpenApiCustomizer schemaCustomizer() {

components.setSchemas(schemas);

// Remove DTO suffix from reponse schemas
var paths = openApi.getPaths();
paths.forEach((path, pathItem) -> {
logger.info(path);
pathItem.readOperations().forEach(operation -> {
// Remove DTO suffix from reponse schemas
var responses = operation.getResponses();
responses.forEach((responseCode, response) -> {
var content = response.getContent();
Expand All @@ -82,8 +82,15 @@ public OpenApiCustomizer schemaCustomizer() {

});
});

// Remove -controller suffix from tags
operation.setTags(operation.getTags()
.stream()
.map(tag -> tag.substring(0, tag.length() - 11)).toList());
});
});


};
}

Expand Down

0 comments on commit aa39217

Please sign in to comment.