title: How to parse extensions of yaml in OpenApi.NET into .NET classes?
body: <p>I need to write ExtensionParsers for <a href="https://github.com/microsoft/OpenAPI.NET" rel="nofollow noreferrer">OpenApi.NET</a>, so that when I parse a yaml document, the extension properties (properties named x-something) are parsed into the corresponding C# classes that I wrote instead of being parsed generally into OpenApiObject.</p>
  
  <p>So for example, when I use <a href="https://github.com/microsoft/OpenAPI.NET" rel="nofollow noreferrer">OpenApi.NET</a> to parse the following yaml document:</p>
  
  <pre><code>openapi: 3.0.2
  info:
    title: 'My interface'
    version: '1.0'
  servers:
    - url: https://www.example.com
  paths:
    "/student":
      get:
        parameters:
        - name: school
          in: query
          schema:
            type: string
        x-setting:
          name: 'Hello world'
          number: 312
          device: mobile
        responses:
          "200":
            description: Successful
            headers:
              Content-Type:
                schema:
                  type: string
            content:
              application/json:
                schema:
                  type: string
  </code></pre>
  
  <p>the parameter object is parsed to a C# object of type OpenApiParameter, name is of type string, In is an enum of type ParameterLocation and schema is of type OpenApiSchema.</p>
  
  <p>But x-setting is parsed to a C# object of type OpenApiObject, name is parsed as OpenApiString, number is parsed as OpenApiInteger and device as OpenApiString.</p>
  
  <p>But as I already have the following c# class:</p>
  
  <pre><code>class Setting
      {
          string Name;
          int Number;
          Device Device;
      }
  </code></pre>
  
  <p>I want it to be parsed to a C# object of type Setting, name as string, number as integer and device as an enum of type Device. Exactly like the parameter object.</p>
  
  <p>It is mentioned <a href="https://github.com/microsoft/OpenAPI.NET/blob/vnext/src/Microsoft.OpenApi.Readers/OpenApiReaderSettings.cs" rel="nofollow noreferrer">here</a> that this can be done using the property ExtensionParsers. But it is not clear how.</p>
  
  <p>There are no docs and the explanation in comments in code is not so good. So could someone help on this?</p>
  
  <p>Many thanks.</p>