Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
kifj committed Feb 18, 2024
1 parent dba90f7 commit e290976
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
20 changes: 20 additions & 0 deletions etc/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,26 @@ paths:
description: OK
components:
schemas:
Action:
description: Executable action
enum:
- SUBSCRIBE
- UNSUBSCRIBE
type: string
Command:
description: Action to execute for a share
required:
- action
- key
type: object
properties:
action:
$ref: '#/components/schemas/Action'
key:
description: the share
type: string
xml:
name: command
error:
description: Structured error message
type: object
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/x1/stomp/boundary/OpenAPIModelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ public OpenAPI buildModel() {

try {
LOCK.await();
// add server by a relative url: works only if using swagger UI deployed with the application
var server = OASFactory.createServer().description("stage").url(servletContext.getContextPath());
openAPI.addServer(server);
} catch (InterruptedException e1) {
return openAPI;
// ignore
}

// add server by a relative url: works only if using swagger UI deployed with
// the application
var server = OASFactory.createServer().description("stage").url(servletContext.getContextPath());
openAPI.addServer(server);
return openAPI;
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/x1/stomp/test/SchemaExportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void testSchemaExport() {
MetadataSources metadata = new MetadataSources(
new StandardServiceRegistryBuilder().applySetting(AvailableSettings.DIALECT, PostgreSQLDialect.class.getName())
.applySetting(AvailableSettings.DEFAULT_SCHEMA, "stocks").build());
new SchemaExport().setOutputFile("target/ddl.sql").setFormat(true).create(EnumSet.of(TargetType.SCRIPT),
new SchemaExport().setOutputFile("target/generated/ddl.sql").setFormat(true).create(EnumSet.of(TargetType.SCRIPT),
metadata.addAnnotatedClass(Share.class).buildMetadata());
}
}

0 comments on commit e290976

Please sign in to comment.