Skip to content

Commit

Permalink
Adding basic schema generation for 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rcooper-kr committed Nov 19, 2024
1 parent 4b79956 commit 4e9f3fa
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import java.util.Objects;
import java.util.stream.Collectors;

import static java.util.Optional.ofNullable;

@SuppressWarnings({"SwitchStatementWithTooFewBranches", "unchecked"})
public class Engine {

Expand Down Expand Up @@ -76,7 +78,8 @@ public void run(File source, File output, String packageName, JsonGenerationConf
})
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
var payloadsWithSchemas = new HashMap<>(payloads);
payloadsWithSchemas.putAll(schema3.getComponents().getSchemas().getAdditionalProperties());
ofNullable(schema3.getComponents().getSchemas())
.ifPresent(schemas -> payloadsWithSchemas.putAll(schemas.getAdditionalProperties()));
var resolved = extractor.resolveAllOfInTheBaseTypes(source.toURI(), schema3, payloadsWithSchemas);
extractor.extract(resolved);
extractor.render(jsonGenerationConfig);
Expand Down

0 comments on commit 4e9f3fa

Please sign in to comment.