Authress-Engineering / openapi-explorer

OpenAPI Web component to generate a UI from the spec.
Apache License 2.0
316 stars 42 forks source link

Request with form data and fields with anyOf or oneOf get wrong name in submit #268

Closed neongrau closed 5 days ago

neongrau commented 5 days ago

instead of the actual field name they get submitted with the numbering as the anyOf/oneOf values are displayed

Bildschirmfoto 2024-11-22 um 15 23 25

Even the curl command will directly show the value as

curl .... -F "1=2024-01-01"

wparad commented 5 days ago

Please include the minimal spec to demonstrate this. Closing for now. Will reopen after spec is included.

neongrau commented 5 days ago

Does this help ?

---
paths:
  "/api/v4/tenants/{tenant_id}/staffs/{id}":
    put:
      summary: Update Employees
      tags:
      - Contacts & Employees
      operationId: tenants-staffs-update
      description: "This endpoint..."
      security:
      - Bearer: []
      parameters:
      - name: tenant_id
        in: path
        required: true
        description: Employees tenant_id
        schema:
          type: string
      - name: id
        in: path
        required: true
        description: Employees id
        schema:
          type: string
      - name: locale
        in: query
        description: to control the language returned
        schema:
          "$ref": "#/components/schemas/locales"
      responses:
        '200':
          description: Staff updated
          content:
            application/json:
              schema:
                type: object
                required:
                - data
                description: Single endpoints will return an object as data
                properties:
                  data:
                    type: object
                    required:
                    - id
                    - type
                    - attributes
                    properties:
                      id:
                        type: string
                      type:
                        type: string
                        enum:
                        - staff
                      attributes:
                        anyOf:
                        - "$ref": "#/components/schemas/StaffSerializer"
                        - "$ref": "#/components/schemas/StaffOverviewSerializer"
                      relationships:
                        "$ref": "#/components/schemas/relationships"
                      links:
                        description: URL resources for this record
                        anyOf:
                        - "$ref": "#/components/schemas/StaffSerializer.Links"
                  meta:
                    "$ref": "#/components/schemas/meta"
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                data[email]:
                  type: string
                  nullable: true
                  format: email
                  description: email (must be unique)
                  oneOf:
                  - type: string
                    nullable: true
                    description: to remove set to null or blank
                  - type: string
                    format: email
                    description: a valid email address
                data[joined]:
                  type: string
                  description: date the employee joined the facility
                  oneOf:
                  - type: string
                    format: date
                    description: ISO 8601 date
                  - type: string
                    format: date_time
                    description: ISO 8601 datetime (time will be ignored)