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

Nested context paths #5758

Open
ikhoon opened this issue Jun 13, 2024 · 1 comment · May be fixed by #5846
Open

Nested context paths #5758

ikhoon opened this issue Jun 13, 2024 · 1 comment · May be fixed by #5846

Comments

@ikhoon
Copy link
Contributor

ikhoon commented Jun 13, 2024

Currently, a context path is only supported at the root path.
Nested context paths will help group and isolate each service.

sb.contextPath("/rest")
      .contextPath("/catalog")
          .service("/product", new GetProductService())
          .service("/products", new ProductsHandler())
          .and()
      .contextPath("/cart")
          .service("/checkout", new CheckoutService());
          ... 
          .and()
      .and()
  .contextPath("/gql")
      .service("/catalog", new GraphQLService());

Discussion: https://discord.com/channels/1087271586832318494/1250406858100047896/1250406882426753036

@chickenchickenlove
Copy link
Contributor

chickenchickenlove commented Jul 29, 2024

Hello @ikhoon nim.
May i look at this issue?

I understood it like this. is my understanding correct?

  • /rest/catalog/product => getProductService()
  • /rest/catalog/products => productsHandler()
  • /rest/cart/checkout => checkoutService()
  • /qql/catalog => GraphQLService()

If we use and() to go back 1-depth before,
I think it will cause breakpoints.

From now, and() return Generic <T>. In most case, Generic <T> is ServerBuilder Type.
However, contextPath() will returns ContextPathServiceBuilder type.
Thus, it will make breaking change.

How about before() or previous() instead of using and() generally to go back 1-depth before?
I think, in that way, user will not encounter braking changes.

For Example,

sb.contextPath("/rest")
      .contextPath("/catalog")
          .service("/product", new GetProductService())
          .service("/products", new ProductsHandler())
          .before()
      .contextPath("/cart")
          .contextPath("/foo")
               .contextPath("/bar")
                    .service("/checkout", new CheckoutService());
                    .and()
  .contextPath("/gql")
      .service("/catalog", new GraphQLService());
  • /rest/catalog/product => getProductService
  • /rest/catalog/products => productsHandler
  • /rest/cart/foo/bar/checkout => checkoutService
  • /gql/catalog => GraphQLService.

@chickenchickenlove chickenchickenlove linked a pull request Jul 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants