Remove handler name, use the last path segment to name the payload class
This commit is contained in:
parent
92098b1a3b
commit
20aa2becfb
6 changed files with 24 additions and 22 deletions
|
@ -114,9 +114,10 @@ public class NodeTransformer {
|
|||
SimpleNode handlerParseNode =
|
||||
assertSimpleNodeType(
|
||||
node.jjtGetChild(1),
|
||||
TapirParserTreeConstants.JJTCOMPOUNDDATATYPE
|
||||
TapirParserTreeConstants.JJTDATATYPEFIELDS
|
||||
);
|
||||
HandlerNode handlerNode = handleHandler(handlerParseNode);
|
||||
List<FieldNode> fields = handleFields(handlerParseNode);
|
||||
HandlerNode handlerNode = new HandlerNode(pathsNode.paths().getLast(), fields);
|
||||
return new EndpointNode(pathsNode, handlerNode);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,25 +56,26 @@ public class TargetGenerator {
|
|||
cfg.setLogTemplateExceptions(false);
|
||||
cfg.setWrapUncheckedExceptions(true);
|
||||
cfg.setFallbackOnNullLoopVariable(false);
|
||||
Template temp = cfg.getTemplate(ENDPOINTS_TEMPLATE_NAME);
|
||||
List<Path> templates = Files
|
||||
.list(this.templatePath)
|
||||
.filter(Files::isRegularFile)
|
||||
.filter(f -> f.getFileName().toString().endsWith(".ftl"))
|
||||
.toList() ;
|
||||
for (Path template : templates) {
|
||||
for (Path templatePath : templates) {
|
||||
try (var outputFile = Files.newBufferedWriter(
|
||||
outputName(template),
|
||||
outputName(templatePath),
|
||||
StandardOpenOption.CREATE,
|
||||
StandardOpenOption.TRUNCATE_EXISTING
|
||||
)) {
|
||||
if (this.verbose) {
|
||||
System.out.println("Processing " + template);
|
||||
System.out.println("Processing " + templatePath);
|
||||
}
|
||||
HashMap<String, Object> templateData = new HashMap<>();
|
||||
templateData.put("endpoints", endpoints);
|
||||
templateData.put("datatypes", dataTypes);
|
||||
temp.process(templateData, outputFile);
|
||||
cfg.getTemplate(
|
||||
templatePath.getFileName().toString()
|
||||
).process(templateData, outputFile);
|
||||
}
|
||||
}
|
||||
} catch (TemplateException | IOException ex) {
|
||||
|
|
|
@ -90,7 +90,7 @@ void dataTypes() :
|
|||
void endpoint() :
|
||||
{}
|
||||
{
|
||||
path() <TRANSITION> compoundDataType()
|
||||
path() <TRANSITION> <OPENPARANTHESIS> dataTypeFields() <CLOSEPARANTHESIS>
|
||||
}
|
||||
|
||||
void endpoints() :
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue