Stoobly / stoobly-agent

Record, mock, and test HTTP/HTTPS requests. CLI agent for Stoobly.
Other
6 stars 0 forks source link

223 missing parent child relationships and type values #237

Closed tylerbhadra closed 1 month ago

tylerbhadra commented 1 month ago

Changes Made

Fixed the endpoint import service so it sends the correct \_id values in POST requests. Refactored OAS adapter and SchemaBuilder so parent-child relationships between component param names are preserved, and parameters that share the same name are not overwritten as a result of flattening nested schemas. The functions __extract_param_properties and __dereference (from OAS adapter), and build (from SchemaBuilder) should be more simple and easier to read.

Expected Benefits

Should fix issues with parent-child relationships and type values (#223)

Example: (petstore-expanded.yaml)

paths:
  /pets:
    get:
      ...
      responses:
        '200':
          description: pet response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Pet'
...
components:
  schemas:
    Pet:
      type: object
      allOf:
        - $ref: '#/components/schemas/NewPet'
        - type: object
          required:
          - id
          properties:
            id:
              type: integer
              format: int64
    NewPet:
      type: object
      required:
        - name  
      properties:
        name:
          type: string
        tag:
          type: string
Screen Shot 2024-05-16 at 5 52 48 PM

Also fixes some bugs that the OAS adapter had:

Testing

Updated SchemaBuilder and OAS adapter tests.

Jvlythical commented 1 month ago

Noticed that for the GET /v1/developer-products/list endpoint, DeveloperproductsElement should be cased as DeveloperProductsElement. image Otherwise, everything else looks good!