openapi: 3.1.0
info:
  title: Storefront Form Fields
  version: 1.0.0
paths:
  /form-fields:
    get:
      operationId: getFormFields
      summary: List Form Fields
      description: |-
        Gets form fields.

        > #### Note
        > * Substitute your storefront domain for `yourstore.example.com`. 
        > * The Send a Test Request feature is not currently supported for this endpoint.
      tags:
        - formFields
      parameters:
        - name: filter
          in: query
          required: false
          schema:
            type: array
            items:
              $ref: '#/components/schemas/FormFieldsGetParametersFilterSchemaItems'
      responses:
        '200':
          description: Returns an object with form fields groups.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FormFieldGroups'
servers:
  - url: https://your_store.example.com/api/storefront
    description: https://{store_domain}/api/storefront
components:
  schemas:
    FormFieldsGetParametersFilterSchemaItems:
      type: string
      enum:
        - customerAccount
        - shippingAddress
        - billingAddress
      title: FormFieldsGetParametersFilterSchemaItems
    FormFieldType:
      type: string
      enum:
        - integer
        - string
        - array
        - date
      description: Type of the value hold by the field
      title: FormFieldType
    FormFieldFieldType:
      type: string
      enum:
        - checkbox
        - text
        - date
        - multiline
        - radio
        - dropdown
      description: Type of the field
      title: FormFieldFieldType
    FormFieldRequirements:
      type: object
      properties:
        alpha:
          type: string
          description: Regex expression for the required alpha characters.
        description:
          type: string
          description: Description for the password requirements.
        minlength:
          type: integer
          description: Minimum password length.
        numeric:
          type: string
          description: Regex expression for the required numeric characters.
      description: Password requirements (password field type only).
      title: FormFieldRequirements
    FormFieldOptionsItemsItems:
      type: object
      properties:
        label:
          type: string
        value:
          type: string
      title: FormFieldOptionsItemsItems
    FormFieldOptions:
      type: object
      properties:
        helperLabel:
          type: string
          description: Placeholder text for dropdown field type.
        items:
          type: array
          items:
            $ref: '#/components/schemas/FormFieldOptionsItemsItems'
          description: List of possible values for this field.
      description: Extra data for radio, dropdown and checkbox field types.
      title: FormFieldOptions
    FormField:
      type: object
      properties:
        id:
          type: string
          description: Field unique ID
        name:
          type: string
          description: Field name
        custom:
          type: boolean
          description: Whether this is a custom field or system built-in field.
        label:
          type: string
          description: User-friendly label
        required:
          type: boolean
          description: Whether this field is required or not
        default:
          type: string
          description: The field unique ID
        type:
          $ref: '#/components/schemas/FormFieldType'
          description: Type of the value hold by the field
        fieldType:
          $ref: '#/components/schemas/FormFieldFieldType'
          description: Type of the field
        min:
          type: string
          description: The minimum valid value for the field (integer and date type only).
        max:
          type: string
          description: The minimum valid value for the field (integer and date type only).
        maxLength:
          type: integer
          description: The maximum length for the value (string type only).
        secret:
          type: boolean
          description: Whether the field represents a password field (password field type only).
        requirements:
          $ref: '#/components/schemas/FormFieldRequirements'
          description: Password requirements (password field type only).
        options:
          $ref: '#/components/schemas/FormFieldOptions'
          description: Extra data for radio, dropdown and checkbox field types.
      description: Form Field
      title: FormField
    FormFields:
      type: array
      items:
        $ref: '#/components/schemas/FormField'
      description: List of form fields for the group
      title: FormFields
    FormFieldGroups:
      type: object
      properties:
        customerAccount:
          $ref: '#/components/schemas/FormFields'
        shippingAddress:
          $ref: '#/components/schemas/FormFields'
        billingAddress:
          $ref: '#/components/schemas/FormFields'
      description: Group of form field groups
      title: FormFieldGroups
