title: How to generate JSON examples from OpenAPI 3.0 specification
body: <p>I'm trying to generate Json examples from OpenAPI specifications by using swagger parser, the problem is that when I try to run my code it returns an exception for the following line :<br>
   Map &lt; String, Schema > definitions = swagger.getComponents().getSchemas();</p>
  
  <pre><code>import io.swagger.v3.oas.models.OpenAPI;
  import io.swagger.v3.parser.OpenAPIV3Parser;
  import io.swagger.v3.oas.models.media.Schema;
  import io.swagger.oas.inflector.examples.models.Example;
  import io.swagger.oas.inflector.examples.ExampleBuilder;
  import com.fasterxml.jackson.databind.module.SimpleModule;
  import io.swagger.oas.inflector.processors.JsonNodeExampleSerializer;
  import io.swagger.util.Json;
  import java.util.Map;
  
  public class essai {
  public static void main(String[] args) throws Exception {
      OpenAPI swagger = new OpenAPIV3Parser().read("C:\\Users\\User1\\Desktop\\openapi.yaml");
              Map &lt; String, Schema &gt; definitions = swagger.getComponents().getSchemas();
              Schema model = definitions.get("Pet");
              Example example = ExampleBuilder.fromSchema(model, definitions);
              SimpleModule simpleModule = new SimpleModule().addSerializer(new JsonNodeExampleSerializer());
              Json.mapper().registerModule(simpleModule);
              String jsonExample = Json.pretty(example);
              System.out.println(jsonExample);
  }
  }
  </code></pre>
  
  <p>The error message is :
  Exception in thread "main" java.lang.NullPointerException
      at com.example.demo.essai.main(essai.java:16)</p>