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

Operations in version specs should be additive over time #99

Closed
cmars opened this issue Dec 14, 2021 · 1 comment · Fixed by #115
Closed

Operations in version specs should be additive over time #99

cmars opened this issue Dec 14, 2021 · 1 comment · Fixed by #115

Comments

@cmars
Copy link
Contributor

cmars commented Dec 14, 2021

We found that carrying prior versions' paths forward and copying them into the next version to be cumbersome, brittle, and error prone.

Instead of requiring each version release to re-declare and re-enumerate all its operations, operations should be deprecated by newer versions if re-declared; otherwise, the older release should still resolve until deprecated and sunset.

Scenario

To illustrate how this should work:

Initial version of a resource "things" is released as things/2021-08-20/spec.yaml, which declares:

paths:
  '/things/{id}':
    get: {...}
  '/things:
    get: {...}

Following version of things, things/2021-09-30/spec.yaml declares:

paths:
  '/things/{id}':
    delete: {...}

Current interpretation

The current implementation sees each version spec as a standalone contract defining the resource. So, it basically interprets this as: "on 2021-09-30, two GET operations were removed and a DELETE operation was added". Ok, that might be precise enough for machines, but it makes things a lot harder on developers; you have to remember to copy over each operation, hopefully you get it right, and if you don't, users of the latest API at that stability will be in for an unpleasant surprise.

Proposed interpretation

Proposal here is to change the interpretation to: "on 2021-09-30, a new DELETE operation was added". It doesn't "erase" the prior GETs; at 2021-09-30, those operations (path + method) still resolve to the 2021-08-20 versions.

Solution

The only thing that changes here is how resource versions are compiled. The resulting output for the effective API versions:

2021-08-20/spec.yaml:

paths:
  /things:
    get: {...}
  /things/{id}:
    get: {...}

2021-09-30/spec.yaml:

paths:
  /things:
    get: {...}
  /things/{id}:
    get: {...}
    delete: {...}

Implications

Existing usage

Existing resources that were re-declaring their prior operations across versions will not need to change anything; they will not need to do this anymore in future releases, once upgrading to this change.

Explicit operation sunsetting

In cases where an operation (path + method) needs to be removed, this deprecation and sunsetting process will need to be made explicit. A followup issue will propose how that should work.

Release version

Because this is a pretty fundamental change in output, this change should be released as a major version bump (2.0.0).

@cmars cmars changed the title Paths in versions should be additive over time Operations in version specs should be additive over time Dec 14, 2021
@cmars
Copy link
Contributor Author

cmars commented Jan 4, 2022

The only thing that changes here is how resource versions are compiled.

To better clarify this point, what really changes is the implementation of ResourceVersions.At. Instead of returning the snapshot spec at a particular version, this method would get updated to return a cumulative spec across all versions, containing the most recent non-sunset version of each operation.

cmars added a commit to cmars/vervet that referenced this issue Jan 4, 2022
Fixes snyk#99, snyk#100.

This changes how operation (path + method) are resolved and merged
across versions of a resource.

Operations are now cumulative. Unless a particular operation (path +
method) is redefined or explicitly deprecated, past releases are assumed
to carry over to newer versions.
cmars added a commit to cmars/vervet that referenced this issue Jan 6, 2022
Fixes snyk#99, snyk#100.

This changes how operation (path + method) are resolved and merged
across versions of a resource.

Operations are now cumulative. Unless a particular operation (path +
method) is redefined or explicitly deprecated, past releases are assumed
to carry over to newer versions.

BREAKING CHANGE: This changes the behavior of the compiler and
resulting output. While we do not anticipate any breaking changes to
OpenAPI consumers, it's worthy of a major version bump.
cmars added a commit to cmars/vervet that referenced this issue Jan 6, 2022
Fixes snyk#99, snyk#100.

This changes how operation (path + method) are resolved and merged
across versions of a resource.

Operations are now cumulative. Unless a particular operation (path +
method) is redefined or explicitly deprecated, past releases are assumed
to carry over to newer versions.

BREAKING CHANGE: This changes the behavior of the compiler and
resulting output. While we do not anticipate any breaking changes to
OpenAPI consumers, it's worthy of a major version bump.
cmars added a commit to cmars/vervet that referenced this issue Jan 6, 2022
Fixes snyk#99, snyk#100.

This changes how operation (path + method) are resolved and merged
across versions of a resource.

Operations are now cumulative. Unless a particular operation (path +
method) is redefined or explicitly deprecated, past releases are assumed
to carry over to newer versions.

BREAKING CHANGE: This changes the behavior of the compiler and
resulting output. While we do not anticipate any breaking changes to
OpenAPI consumers, it's worthy of a major version bump.
cmars added a commit to cmars/vervet that referenced this issue Jan 11, 2022
Fixes snyk#99, snyk#100.

This changes how operation (path + method) are resolved and merged
across spec versions within a stability level.

Operations are now cumulative. Unless a particular operation (path +
method) is redefined or explicitly deprecated, past releases are assumed
to carry over to newer versions.

BREAKING CHANGE: This changes the behavior of the compiler and resulting
output. It's also a breaking API change, requiring a major version bump.
We do not anticipate any breaking changes to OpenAPI consumers.
cmars added a commit to cmars/vervet that referenced this issue Jan 11, 2022
Fixes snyk#99, snyk#100.

This changes how operation (path + method) are resolved and merged
across spec versions within a stability level.

Operations are now cumulative. Unless a particular operation (path +
method) is redefined or explicitly deprecated, past releases are assumed
to carry over to newer versions.

BREAKING CHANGE: This changes the behavior of the compiler and resulting
output. It's also a breaking API change, requiring a major version bump.
We do not anticipate any breaking changes to OpenAPI consumers.
cmars added a commit to cmars/vervet that referenced this issue Jan 11, 2022
Fixes snyk#99, snyk#100.

This changes how operation (path + method) are resolved and merged
across spec versions within a stability level.

Operations are now cumulative. Unless a particular operation (path +
method) is redefined or explicitly deprecated, past releases are assumed
to carry over to newer versions.

BREAKING CHANGE: This changes the behavior of the compiler and resulting
output. It's also a breaking API change, requiring a major version bump.
We do not anticipate any breaking changes to OpenAPI consumers.
cmars added a commit to cmars/vervet that referenced this issue Jan 11, 2022
Fixes snyk#99, snyk#100.

This changes how operation (path + method) are resolved and merged
across spec versions within a stability level.

Operations are now cumulative. Unless a particular operation (path +
method) is redefined or explicitly deprecated, past releases are assumed
to carry over to newer versions.

BREAKING CHANGE: This changes the behavior of the compiler and resulting
output. It's also a breaking API change, requiring a major version bump.
We do not anticipate any breaking changes to OpenAPI consumers.
cmars added a commit to cmars/vervet that referenced this issue Jan 11, 2022
Fixes snyk#99, snyk#100.

This changes how operation (path + method) are resolved and merged
across spec versions within a stability level.

Operations are now cumulative. Unless a particular operation (path +
method) is redefined or explicitly deprecated, past releases are assumed
to carry over to newer versions.

BREAKING CHANGE: This changes the behavior of the compiler and resulting
output. It's also a breaking API change, requiring a major version bump.
We do not anticipate any breaking changes to OpenAPI consumers.
cmars added a commit to cmars/vervet that referenced this issue Jan 12, 2022
Fixes snyk#99.

This changes how operation (path + method) are resolved and merged
across spec versions within a stability level.

Operations are now cumulative. Unless a particular operation (path +
method) is redefined or explicitly deprecated, past releases are assumed
to carry over to newer versions.

BREAKING CHANGE: This changes the behavior of the compiler and resulting
output. It's also a breaking API change, requiring a major version bump.
We do not anticipate any breaking changes to OpenAPI consumers.
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 a pull request may close this issue.

1 participant