Skip to content

Commit

Permalink
[openrpc2adoc] fix param table
Browse files Browse the repository at this point in the history
  • Loading branch information
rmannibucau committed Jan 26, 2024
1 parent 806ef35 commit f17013f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,17 @@ public String convert(final Map<String, Object> openrpc, final JsonMapper ignore
private String toSchemaAdoc(final Map<String, Object> schemas, final String name, final Map<String, Object> schema) {
return "=== " + schema.getOrDefault("title", name) + " (" + name + ") schema\n" +
"\n" +
"[cols=\"1,1\"]\n" +
"[cols=\"1,1,1\"]\n" +
"|===\n" +
"|Name|Type|Nullable\n" +
asObject(schema.getOrDefault("properties", Map.of())).entrySet().stream()
.map(e -> "\n" +
"|" + e.getKey() + "\n" +
"|" + type(schemas, asObject(e.getValue()), new HashSet<>()) + "\n")
.map(e -> {
final var model = asObject(e.getValue());
return "\n" +
"|" + e.getKey() + "\n" +
"|" + type(schemas, model, new HashSet<>()) + "\n" +
"|" + (model.get("nullable") instanceof Boolean b && b) + "\n";
})
.collect(joining()) +
"|===";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ void render(@TempDir final Path work) throws IOException {
=== Greeting (org.example.application.jsonrpc.Greeting) schema
[cols="1,1"]
[cols="1,1,1"]
|===
|Name|Type|Nullable
|message
|`string`
|true
|===
""", Files.readString(out));
Expand Down

0 comments on commit f17013f

Please sign in to comment.