Skip to content

Redundant externalResource and endpoint #930

Closed
@JBBianchi

Description

@JBBianchi

What would you like to be added:
In the JSON Schema, externalResource and endpoint are very similar:

# from #/$defs
  externalResource:
    oneOf:
      - type: string
        format: uri
      - type: object
        properties:
          uri:
            type: string
            format: uri
            description: The endpoint's URI.
          authentication:
            description: The authentication policy to use.
            oneOf:
              - $ref: '#/$defs/authenticationPolicy'
              - type: string
          name:
            type: string
            description: The external resource's name, if any.
        required: [ uri ]

  endpoint:
    type: object
    properties:
      uri:
        type: string
        format: uri-template
        description: The endpoint's URI.
      authentication:
        description: The authentication policy to use.
        oneOf:
          - $ref: '#/$defs/authenticationPolicy'
          - type: string
    required: [ uri ]

And endpoint is only used once in CallHTTP as:

# from #/$defs/callTask/oneOf/2 (CallHTTP)/properties/with/properties
  endpoint:
    description: The HTTP endpoint to send the request to.
    oneOf:
      - $ref: '#/$defs/endpoint'
      - type: string
        format: uri-template

There is a clear overlap. The only difference is the name property in externalResource.

I think we could either keep only externalResource or refactor it to use endpoint:

  externalResource:
    oneOf:
      - type: string
        format: uri
      - type: object
        $ref: #/$defs/endpoint
        unevaluatedProperties: false
        properties:
          name:
            type: string
            description: The external resource's name, if any.

Why is this needed:
It keeps the JSON Schema better alligned with the DRY principle.

Metadata

Metadata

Assignees

Labels

area: specChanges in the Specificationchange: breakingA breaking change that will impact in a major version change.

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions