[ https://issues.apache.org/jira/browse/CAUSEWAY-3752?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Keir Haywood updated CAUSEWAY-3752: ------------------------------------------ Description: Before releasing 2.0.0/3.0.0, we decided to make `@DomainService(nature=VIEW|REST_ONLY)` a no-op , for a couple of reasons: * we now have a GraphQL viewer, and the enum didn't seem general enough * the REST API has its own rather adhoc mechanism for what to expose: public, prototyping or private ** but this only affects the Swagger file, not the actual API that's actually available * the GraphQL viewer has an issue that it takes a loooong time to expose the entire API; and probably we wouldn't want to do that. In removing `@DomainService(nature=...)`, we told ourselves that users could just use security; but that doesn't address the above issues. The proposal is to introduce this SPI: {code:java} enum ViewerType { WICKET, REST, GRAPHQL } public interface ViewerFilterSpi { /** * the classes to be */ Optional<List<Class<?>>> include(ViewerType); Optional<List<Class<?>>> exclude(ViewerType); } {code} This will be used by the different viewers at different stages: * by Wicket viewer - when rendering * by REST API - when generating swagger + to prevent calls to anything that's not specified... * by GraphQL - when building the GraphQL metamodel {code:java} public class MyAppViewFilter implements ... { public Optional<List<Class<?>>> include(...) { switch viewerType { case WICKET: return Optional.empty; case REST: return Optional.of(Arrays.asList(....)); case GRAPHQL: return Optional.of(Arrays.asList(....)); } } public Optional<List<Class>>> exclude(...) { switch viewerType { case WICKET: return include(REST); case REST: return Optional.empty(); case GRAPHQL: return Optional.empty(); } } } {code} was: Before releasing 2.0.0/3.0.0, we decided to make `@DomainService(nature=VIEW|REST_ONLY)` a no-op , for a couple of reasons: * we now have a GraphQL viewer, and the enum didn't seem general enough * the REST API has its own rather adhoc mechanism for what to expose: public, prototyping or private ** but this only affects the Swagger file, not the actual API that's actually available * the GraphQL viewer has an issue that it takes a loooong time to expose the entire API; and probably we wouldn't want to do that. In removing `@DomainService(nature=...)`, we told ourselves that users could just use security; but that doesn't address the above issues. The proposal is to introduce this SPI: {code:java} enum ViewerType { WICKET, REST, GRAPHQL } public interface ViewerFilterSpi { /** * the classes to be */ Optional<List<Class<?>>> include(ViewerType); Optional<List<Class<?>>> exclude(ViewerType); } {code} This will be used by the different viewers at different stages: * by Wicket viewer - when rendering * by REST API - when generating swagger + to prevent calls to anything that's not specified... * by GraphQL - when building the GraphQL metamodel {code:java} public class MyAppViewFilter implements ... { public Optional<List<Class<?>>> include(...) { switch viewerType { case WICKET: return Optional.empty; case REST: return Optional.of(Arrays.asList(....)); case GRAPHQL: return Optional.of(Arrays.asList(....)); } } public Optional<List<Class>>> exclude(...) { switch viewerType { case WICKET: return include(REST); case REST: return Optional.empty(); case GRAPHQL: return Optional.empty(); } } } {code} > Provide SPI to describe which classes are surfaced by the different viewers. > ---------------------------------------------------------------------------- > > Key: CAUSEWAY-3752 > URL: https://issues.apache.org/jira/browse/CAUSEWAY-3752 > Project: Causeway > Issue Type: New Feature > Components: Core, Viewer GraphQL, Viewer RO, Viewer Wicket > Affects Versions: 2.0.0 > Reporter: Daniel Keir Haywood > Assignee: Daniel Keir Haywood > Priority: Major > Fix For: 2.1.0 > > > Before releasing 2.0.0/3.0.0, we decided to make > `@DomainService(nature=VIEW|REST_ONLY)` a no-op , for a couple of reasons: > * we now have a GraphQL viewer, and the enum didn't seem general enough > * the REST API has its own rather adhoc mechanism for what to expose: > public, prototyping or private > ** but this only affects the Swagger file, not the actual API that's > actually available > * the GraphQL viewer has an issue that it takes a loooong time to expose the > entire API; and probably we wouldn't want to do that. > > In removing `@DomainService(nature=...)`, we told ourselves that users could > just use security; but that doesn't address the above issues. > > The proposal is to introduce this SPI: > > {code:java} > enum ViewerType { > WICKET, > REST, > GRAPHQL > } > public interface ViewerFilterSpi { > /** > * the classes to be > */ > Optional<List<Class<?>>> include(ViewerType); > > Optional<List<Class<?>>> exclude(ViewerType); > } {code} > > This will be used by the different viewers at different stages: > * by Wicket viewer - when rendering > * by REST API - when generating swagger + to prevent calls to anything > that's not specified... > * by GraphQL - when building the GraphQL metamodel > > {code:java} > public class MyAppViewFilter implements ... { > public Optional<List<Class<?>>> include(...) { > switch viewerType { > case WICKET: > return Optional.empty; > case REST: > return Optional.of(Arrays.asList(....)); > case GRAPHQL: > return Optional.of(Arrays.asList(....)); > } > } > public Optional<List<Class>>> exclude(...) { > switch viewerType { > case WICKET: > return include(REST); > case REST: > return Optional.empty(); > case GRAPHQL: > return Optional.empty(); > } > } > } {code} > -- This message was sent by Atlassian Jira (v8.20.10#820010)