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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ 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.17.5
* Boat engine
* Fix: Processing of a single string type example on media-type.
## 0.17.4
* Boat Angular generator
* New format for Angular mocks, which are now export an array with responses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,24 @@ void replaceRef(String ref) {
}
}

private static class StringExampleHolder extends ExampleHolder<String> {

private StringExampleHolder(String name, String value) {
super(name, value);
setContent(value);
}

@Override
String getRef() {
return null;
}

@Override
void replaceRef(String ref) {
// do nothing
}
}

private final String name;

private T example;
Expand Down Expand Up @@ -163,8 +181,11 @@ public static ExampleHolder of(String name, Object o) {
}
} else if( o instanceof ArrayNode) {
return new ArrayNodeExampleHolder(name, (ArrayNode) o);
} else if (o instanceof String) {
return new StringExampleHolder(name, o.toString());
} else {
throw new TransformerException("Unknown type backing example " + o.getClass().getName());
throw new TransformerException(String.format(
"Unknown type backing example %s (%s) '%s'", name, o.getClass().getName(), o));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ paths:
$ref: '#/components/schemas/UserPostResponse'
example:
$ref: ./examples/user-post-response.json
csv:
example: |-
UserId,Username
aaaa-bbbb-cccc,John
post:
summary: Single example
requestBody:
Expand Down