Loading plugins/org.etsi.mts.tdl.openapi2tdl.next/src/org/etsi/mts/tdl/openapi2tdl/next/OpenAPI2TDLTranslatorNext.java +24 −8 Original line number Diff line number Diff line package org.etsi.mts.tdl.openapi2tdl.next; import java.io.File; import java.util.Collections; import java.util.HashSet; import java.util.Hashtable; import java.util.List; Loading Loading @@ -192,6 +193,7 @@ public class OpenAPI2TDLTranslatorNext extends AbstractTranslator { // Map operations to request body schemas so we can create wrappers later Map<String, Set<PathOperation>> schemaOperations = new Hashtable<>(); Set<PathOperation> inlineSchemaOperations = new HashSet<>(); Set<PathOperation> noContentOperations = new HashSet<>(); Paths paths = model.getPaths(); for (String pathUri: paths.keySet()) { Loading @@ -210,16 +212,20 @@ public class OpenAPI2TDLTranslatorNext extends AbstractTranslator { array = true; } String schemaName = schema.get$ref(); if (schemaName == null) { inlineSchemaOperations.add(new PathOperation(pathUri, method, op, array, schema)); } else { schemaName = schemaName.replace("#/components/schemas/", ""); Set<PathOperation> set = schemaOperations.get(schemaName); if (set == null) { set = new HashSet<>(); schemaOperations.put(schemaName, set); } set.add(new PathOperation(pathUri, method, op, array)); set.add(new PathOperation(pathUri, method, op, array, null)); } } } else { noContentOperations.add(new PathOperation(pathUri, method, op, false)); noContentOperations.add(new PathOperation(pathUri, method, op, false, null)); } } } Loading Loading @@ -249,6 +255,14 @@ public class OpenAPI2TDLTranslatorNext extends AbstractTranslator { if (useMessageBasedApi) { createOperationWrapper(noContentOperations, httpRequest, httpMethodEnum, httpRequestParameters, httpParameterLocationEnum); } for (PathOperation op : inlineSchemaOperations) { Schema<?> schema = op.inlineSchema; schema.setName(op.path.substring(1) + "_body"); DataType dataType = translate(schema, "", messageBody); if (useMessageBasedApi) { createOperationWrapper(Collections.singleton(op), httpRequest, httpMethodEnum, httpRequestParameters, httpParameterLocationEnum); } } for (String schemaName : model.getComponents().getSchemas().keySet()) { Schema<?> schema = model.getComponents().getSchemas().get(schemaName); schema.setName(schemaName); Loading Loading @@ -575,11 +589,13 @@ public class OpenAPI2TDLTranslatorNext extends AbstractTranslator { String path; HttpMethod method; Operation operation; Schema<?> inlineSchema; boolean array; public PathOperation(String path, HttpMethod method, Operation operation, boolean array) { public PathOperation(String path, HttpMethod method, Operation operation, boolean array, Schema<?> inlineSchema) { this.path = path; this.method = method; this.operation = operation; this.inlineSchema = inlineSchema; this.array = array; } } Loading Loading
plugins/org.etsi.mts.tdl.openapi2tdl.next/src/org/etsi/mts/tdl/openapi2tdl/next/OpenAPI2TDLTranslatorNext.java +24 −8 Original line number Diff line number Diff line package org.etsi.mts.tdl.openapi2tdl.next; import java.io.File; import java.util.Collections; import java.util.HashSet; import java.util.Hashtable; import java.util.List; Loading Loading @@ -192,6 +193,7 @@ public class OpenAPI2TDLTranslatorNext extends AbstractTranslator { // Map operations to request body schemas so we can create wrappers later Map<String, Set<PathOperation>> schemaOperations = new Hashtable<>(); Set<PathOperation> inlineSchemaOperations = new HashSet<>(); Set<PathOperation> noContentOperations = new HashSet<>(); Paths paths = model.getPaths(); for (String pathUri: paths.keySet()) { Loading @@ -210,16 +212,20 @@ public class OpenAPI2TDLTranslatorNext extends AbstractTranslator { array = true; } String schemaName = schema.get$ref(); if (schemaName == null) { inlineSchemaOperations.add(new PathOperation(pathUri, method, op, array, schema)); } else { schemaName = schemaName.replace("#/components/schemas/", ""); Set<PathOperation> set = schemaOperations.get(schemaName); if (set == null) { set = new HashSet<>(); schemaOperations.put(schemaName, set); } set.add(new PathOperation(pathUri, method, op, array)); set.add(new PathOperation(pathUri, method, op, array, null)); } } } else { noContentOperations.add(new PathOperation(pathUri, method, op, false)); noContentOperations.add(new PathOperation(pathUri, method, op, false, null)); } } } Loading Loading @@ -249,6 +255,14 @@ public class OpenAPI2TDLTranslatorNext extends AbstractTranslator { if (useMessageBasedApi) { createOperationWrapper(noContentOperations, httpRequest, httpMethodEnum, httpRequestParameters, httpParameterLocationEnum); } for (PathOperation op : inlineSchemaOperations) { Schema<?> schema = op.inlineSchema; schema.setName(op.path.substring(1) + "_body"); DataType dataType = translate(schema, "", messageBody); if (useMessageBasedApi) { createOperationWrapper(Collections.singleton(op), httpRequest, httpMethodEnum, httpRequestParameters, httpParameterLocationEnum); } } for (String schemaName : model.getComponents().getSchemas().keySet()) { Schema<?> schema = model.getComponents().getSchemas().get(schemaName); schema.setName(schemaName); Loading Loading @@ -575,11 +589,13 @@ public class OpenAPI2TDLTranslatorNext extends AbstractTranslator { String path; HttpMethod method; Operation operation; Schema<?> inlineSchema; boolean array; public PathOperation(String path, HttpMethod method, Operation operation, boolean array) { public PathOperation(String path, HttpMethod method, Operation operation, boolean array, Schema<?> inlineSchema) { this.path = path; this.method = method; this.operation = operation; this.inlineSchema = inlineSchema; this.array = array; } } Loading