I'm trying to read the properties of each object in the Schema field from an OpenAPI 3 specification.
I used a loop to read the schema field from this OpenAPI 3 spec but now I need to retrieve the name of each property. Here is my code :
Map<String, Schema> definitions = swagger.getComponents().getSchemas();
for (Map.Entry<String, Schema> path : definitions.entrySet())
{
System.out.println(path.getKey() + "/" + path.getValue().getProperties());
}
I expect an output like this :
Pet/[id]
NewPet/[name,tag]
Error/[code, message]
But this is the snippet of the actual output:
Pet/null
NewPet/{name=class StringSchema {
class Schema {
title: null
multipleOf: null
maximum: null
exclusiveMaximum: null
minimum: null
exclusiveMinimum: null
All I need is to retrieve the value that precedes the "=class", in this case "name"