Skip to content

Commit

Permalink
do not attempt to generate a dialog service if no endpoints (#2237)
Browse files Browse the repository at this point in the history
Skips generating the Endpoints enum if no endpoints.
  • Loading branch information
esword authored Mar 18, 2024
1 parent 828fb8c commit 9db84b2
Show file tree
Hide file tree
Showing 15 changed files with 356 additions and 4 deletions.
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-2237.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: do not attempt to generate a dialog service if no endpoints
links:
- https://github.com/palantir/conjure-java/pull/2237
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ public Stream<JavaFile> generate(ConjureDefinition conjureDefinition) {
StaticFactoryMethodType.BLOCKING);

return conjureDefinition.getServices().stream()
.flatMap(serviceDef -> Stream.of(
endpoints.endpointsClass(serviceDef),
interfaceGenerator.generateBlocking(serviceDef, blockingGenerator),
interfaceGenerator.generateAsync(serviceDef, asyncGenerator)));
.flatMap(serviceDef -> !serviceDef.getEndpoints().isEmpty()
? Stream.of(
endpoints.endpointsClass(serviceDef),
interfaceGenerator.generateBlocking(serviceDef, blockingGenerator),
interfaceGenerator.generateAsync(serviceDef, asyncGenerator))
: Stream.of(
interfaceGenerator.generateBlocking(serviceDef, blockingGenerator),
interfaceGenerator.generateAsync(serviceDef, asyncGenerator)));
}
}
9 changes: 9 additions & 0 deletions conjure-java-core/src/test/resources/example-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,12 @@ services:
strings:
type: set<AliasedString>
param-type: query
TestEmptyService:
name: Empty Test Service
package: com.palantir.another
default-auth: header
base-path: /testEmptyService
docs: |
This service has no endpoints.
endpoints: {}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9db84b2

Please sign in to comment.