Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ The project is very much Work In Progress and will be published on maven central
# Release Notes
BOAT is still under development and subject to change.

## 0.14.8
* *Boat Marina*
* Removes flatObjects as they are no longer needed
* response.message was wrongfully escaped, escaping in the docs template instead
* We no longer need to generate model aliases in boat marina
## 0.14.7
* *Boat Marina*
* Exports flatObjects as a model to prevent errors with references
Expand Down
2 changes: 1 addition & 1 deletion boat-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.14.7</version>
<version>0.14.8</version>
</parent>
<artifactId>boat-engine</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion boat-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.14.7</version>
<version>0.14.8</version>
</parent>
<artifactId>boat-maven-plugin</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion boat-quay/boat-quay-lint/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-quay</artifactId>
<version>0.14.7</version>
<version>0.14.8</version>
</parent>
<artifactId>boat-quay-lint</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion boat-quay/boat-quay-rules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-quay</artifactId>
<version>0.14.7</version>
<version>0.14.8</version>
</parent>
<artifactId>boat-quay-rules</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion boat-quay/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.14.7</version>
<version>0.14.8</version>
</parent>


Expand Down
4 changes: 2 additions & 2 deletions boat-scaffold/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.14.7</version>
<version>0.14.8</version>
</parent>
<artifactId>boat-scaffold</artifactId>

Expand Down Expand Up @@ -86,7 +86,7 @@
<dependency>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-trail-resources</artifactId>
<version>0.14.7</version>
<version>0.14.8</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenParameter;
import org.openapitools.codegen.CodegenResponse;
import org.openapitools.codegen.utils.ModelUtils;

import java.io.IOException;
import java.nio.charset.Charset;
Expand Down Expand Up @@ -71,14 +70,6 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
.collect(Collectors.toList()));
}

// We need freeForm objects as models as well, since they are being referenced with $ref
if (openAPI.getComponents().getSchemas() != null) {
additionalProperties.put("freeFormModels", openAPI.getComponents().getSchemas().entrySet().stream()
.filter(freeFormModel -> ModelUtils.isFreeFormObject(freeFormModel.getValue()))
.map(this::mapFreeFormObject)
.collect(Collectors.toList()));
}

if (openAPI.getPaths() != null)
// Ensure single tags for operations
openAPI.getPaths().forEach((path, pathItem) ->
Expand All @@ -104,10 +95,6 @@ private BoatExample mapComponentExample( Map.Entry<String, Example> namedExample
return new BoatExample(key,"", example , false);
}

private Object mapFreeFormObject(Map.Entry<String, Schema> freeFormObject) {//NOSONAR
String name = freeFormObject.getKey();
return fromModel(name, freeFormObject.getValue());
}

private CodegenParameter mapComponentParameter(Set<String> imports, java.util.Map.Entry<String, Parameter> nameParameter) {
Parameter parameter = nameParameter.getValue();
Expand Down Expand Up @@ -178,8 +165,6 @@ public CodegenParameter fromRequestBody(RequestBody body, Set<String> imports, S
@Override
public CodegenResponse fromResponse(String responseCode, ApiResponse response) {
CodegenResponse r = super.fromResponse(responseCode, response);
r.message = StringUtils.replace(r.message, "`", "\\`");

return new BoatCodegenResponse(r, responseCode, response, openAPI);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.backbase.oss.codegen.doc;

import com.samskivert.mustache.Mustache;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.responses.ApiResponse;
import java.util.ArrayList;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CodegenResponse;

@Slf4j
Expand All @@ -15,6 +17,11 @@
@SuppressWarnings("java:S2387")
public class BoatCodegenResponse extends CodegenResponse {

public static final Mustache.Lambda escapeBackTicks = (fragment, writer) -> {
String text = fragment.execute();
writer.write(StringUtils.replace(text, "`", "\\`"));
};

private final List<BoatExample> examples = new ArrayList<>();

public boolean hasExamples() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public BoatMarinaGenerator() {

embeddedTemplateDir = templateDir = NAME;
cliOptions.add(new CliOption(CodegenConstants.GENERATE_ALIAS_AS_MODEL, CodegenConstants.GENERATE_ALIAS_AS_MODEL));
additionalProperties.put(CodegenConstants.GENERATE_ALIAS_AS_MODEL, true);
additionalProperties.put(CodegenConstants.GENERATE_ALIAS_AS_MODEL, false);
additionalProperties.put("appName", "BOAT Marina Documentation");
additionalProperties.put("appDescription", "For a collection of doc(k)s");
additionalProperties.put("infoUrl", "https://backbase.github.io/backbase-openapi-tools/");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
</div>
</div>
<script>
var response{{baseName}}{{code}}_description = `{{{message}}}`;
var response{{baseName}}{{code}}_description = `{{#escapeBackTicks}}{{{message}}}{{/escapeBackTicks}}`;
var response{{baseName}}{{code}}_description_break = response{{baseName}}{{code}}_description.indexOf('\n');
if (response{{baseName}}{{code}}_description_break == -1) {
$("#examples-{{baseName}}-{{nickname}}-title-{{code}}").html("<span class='response-header-tab-handle'></span> <b>{{code}}</b> " + response{{baseName}}{{code}}_description);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ const data = {
data["parameters"]["{{paramName}}"] = {{{jsonSchema}}};
{{/each}}

{{#each freeFormModels}}
data.models["{{name}}"] = {{{json .}}};
{{/each}}

{{#each swagger.vendorExtensions.x-shared-errors}}
let err = {{{json .}}};
data["errors"][err.errorID] = err;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ void testGenerateDocs() throws IOException {
assertTrue(generated.contains("Simple API overview"));
assertTrue(generated.contains("appDescription: \"No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)\","));
assertTrue(generated.contains("data.examples[\"BadRequestError\"]"));
assertTrue(generated.contains("data.models[\"ParameterMap\"]"));

}

Expand Down
2 changes: 1 addition & 1 deletion boat-terminal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.14.7</version>
<version>0.14.8</version>
</parent>

<artifactId>boat-terminal</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion boat-trail-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.14.7</version>
<version>0.14.8</version>
</parent>
<artifactId>boat-trail-resources</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.14.7</version>
<version>0.14.8</version>
<packaging>pom</packaging>
<description>Backbase Open Api Tools will help you converting RAML to OpenAPI plus many more</description>

Expand Down
2 changes: 1 addition & 1 deletion tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.14.7</version>
<version>0.14.8</version>
</parent>

<artifactId>tests</artifactId>
Expand Down