Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links proposal (updated) #742

Merged
merged 5 commits into from
Jul 22, 2016
Merged

Links proposal (updated) #742

merged 5 commits into from
Jul 22, 2016

Conversation

fehguy
Copy link
Contributor

@fehguy fehguy commented Jul 22, 2016

The previous PR was updated, and the comments got all jacked up. So here's a new PR, the old one has been closed but you can see comments there in all their glory.

@fehguy
Copy link
Contributor Author

fehguy commented Jul 22, 2016

To support operation linking, as suggested in #688, I propose the following:

  • A mechanism for design-time, static links between responses and operations to make operations on responses visible to consumers
  • A reusable linking structure to allow link definitions to be DRY
  • A mechasim for parameterized link traversal to avoid server-side computation of links through reuse of existing, OAS-defined operations

Additional considerations:

  • This is not intended to be a run time linking solution. This solution does not require users to redesign their runtime API. It may be able to represent the intent of runtime HAL-style links in responses. It does not intend to represent dynamically generated, arbitrary links.
  • A clear separation of concerns, between payloads and operations. Therefore no operation data shall be tied to payload schemas.

Spec changes

  • Introduction of a Link Object to represent a single link
  • Addition of a links object in the Response Object to define what links are available from a specific operation
  • Addition of a links section in the Components Object to allow reuse across operations
  • Introduction of a Link Parameters Object to represent parameters to build a link from
  • A mechanism for reading values from response payloads and using them for client-side link computation

missingValue: null
```

In situations where variables appear in an array, an array of variables will be extracted. For example:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs more documentation

operationId| string | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS.
parameters | Link Parameters Object | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`.
description | string | a description of the link, supports GFM.
^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Specification Extensions](#specificationExtensions) for further details.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ralfhandl I added description and x-* extensions

href | url | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field.
operationId | string | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS.
parameters | Link Parameters Object | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`.
headers | Link Headers Object | an Object representing headers to pass to the linked resource.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidBiesack With the addition of headers for the linked resource, we can traverse media types now.

@fehguy fehguy merged commit 2a685c1 into OpenAPI.next Jul 22, 2016
@fehguy
Copy link
Contributor Author

fehguy commented Jul 22, 2016

approved by @OAI/tdc

@kevinswiber
Copy link

I was approaching this PR with some hope that it could be used to support hypermedia types being represented in OAS, but I see now that there's a requirement for the links to be "static." This requirement alone breaks the coupling semantics for Web Linking, on which (nearly?) all the hypermedia types depend.

And that's okay if that's not the supported use case for this feature. But it leaves me a bit bewildered. Can someone help by defining use cases or existing APIs that could benefit from this feature in its current form? It seems like this introduces a lot of hopping around between references to grok what's going on. What are the intended benefits? Maybe it's obvious to most people. Hopefully, it is. But right now, I'm in the dark.

Thanks.

@fehguy
Copy link
Contributor Author

fehguy commented Jul 23, 2016

@kevinswiber consider reading the comments in the previous (mangled) PR and the corresponding issues for the rationale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants