Skip to content

Schema requires authTemplates to have name field, but none of the given examples have it #23

@grebnetiew

Description

@grebnetiew

In the schema, omitting lines not relevant to the issue,

properties:
  authTemplate:
    description: "Optional authentication information template. This is used to avoid duplication in the auth list. \
                 Entries defined in the template will be applied to all elements in the auth list that do not specify them."
    allOf:
    - $ref: "#/$defs/AuthenticationInfo"
    - type: object

# ...
  AuthenticationInfo:
    type: object
    properties:
      name:
        type: string
    required: ["name"]

To me, this suggests the authTemplate must be an AuthenticationInfo, which requires a name field.

However, in the Dataset repo, we find the blogapi example:

auth:
  - name: admin
    loginEndpointAuth:
      payloadRaw: "{\"usernameOrEmail\": \"admin\", \"password\": \"bar123\"}"
  - name: user
    loginEndpointAuth:
      payloadRaw: "{\"usernameOrEmail\": \"user\", \"password\": \"bar123\"}"

authTemplate:
    loginEndpointAuth:
        endpoint: /api/auth/signin
        verb: POST
        contentType: application/json
        token:
            extractFrom: body
            extractSelector: /accessToken
            sendName: Authorization
            sendIn: header
            sendTemplate: "Bearer {token}"

Incidentally, the same holds for LoginEndpointAuth, which requires the verb, but no verbs are specified in the auth array in the example.

The comments suggest that each AuthenticationInfo and its sub-objects may omit required fields at will, as long as the merged variant satisfies the required constraints. However, I don't think that's what the specification actually specifies. Or am I misunderstanding how this kind of specification works?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions