Class ScalaCaskServerCodegen.OperationGroup
- java.lang.Object
-
- org.openapitools.codegen.languages.ScalaCaskServerCodegen.OperationGroup
-
- Enclosing class:
- ScalaCaskServerCodegen
public static class ScalaCaskServerCodegen.OperationGroup extends Object
Cask will compile but 'initialize' can throw a route overlap exception:{{{ Routes overlap with wildcards: get /user/logout, get /user/:username, get /user/login }}}
Note: The same error persists even if the suffixes are unique: {{{ Routes overlap with wildcards: get /user/logout/3, get /user/:username/1, get /user/login/2 }}}
To fix this, we need to identify and resolve conflicts in our generated code.
# How do we identify conflicts?
1. group routes by their non-param prefixes.
2. add an "x-annotation" vendor extension for operations
3. add a list of "RouteGroups" which can manually delegate as per below
# How do we resolve conflicts?
We leave out the cask route annotation on the conflicting operations, e.g. : {{{ //conflict: @cask.get("/user/:username") def getUserByName(username: String, request: cask.Request) = ... }}}
and we introduce a new discriminator function to "manually" call those conflicts: {{{
-
-
Constructor Summary
Constructors Constructor Description OperationGroup(String httpMethod, String pathPrefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(CodegenOperation op)booleancontains(CodegenOperation op)List<CodegenParameter>getGroupQueryParams()This is invoked from `scala-cask/apiRoutesQueryParamsTyped.mustache`booleanhasGroupQueryParams()StringtoString()voidupdateAnnotations()
-
-
-
Method Detail
-
hasGroupQueryParams
public boolean hasGroupQueryParams()
-
getGroupQueryParams
public List<CodegenParameter> getGroupQueryParams()
This is invoked from `scala-cask/apiRoutesQueryParamsTyped.mustache`- Returns:
- the CodegenParameters
-
add
public void add(CodegenOperation op)
-
contains
public boolean contains(CodegenOperation op)
-
updateAnnotations
public void updateAnnotations()
-
-