Skip to content

Commit 75072d4

Browse files
vocabulary: locations, areas, kinds, statuses, and categories
Every field the model uses is now defined in its vocabulary: the location grammar and claim syntax, the areas and kinds carried by each change, and the statuses and categories carried by each coverage row. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QDvUFsg5nu1NBWQffErGDw
1 parent 35fc5ae commit 75072d4

2 files changed

Lines changed: 75 additions & 0 deletions

File tree

‎generator/main.go‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,20 @@ type Model struct {
3131
}
3232

3333
type Vocabulary struct {
34+
// Locations describes the location grammar and the claim syntax built
35+
// on it; locations are an open set derived from the OpenAPI object
36+
// model, not an enumeration.
37+
Locations string `yaml:"locations"`
3438
Actions map[string]string `yaml:"actions"`
3539
Directions map[string]string `yaml:"directions"`
40+
Areas map[string]string `yaml:"areas"`
41+
Kinds map[string]string `yaml:"kinds"`
3642
Effects map[string]string `yaml:"effects"`
3743
Guards map[string]string `yaml:"guards"`
3844
Levels map[string]string `yaml:"levels"`
45+
// Statuses and Categories describe the coverage dispositions.
46+
Statuses map[string]string `yaml:"statuses"`
47+
Categories map[string]string `yaml:"categories"`
3948
}
4049

4150
type SeverityLaw struct {
@@ -112,6 +121,11 @@ func main() {
112121
Version: "0.1.0-draft",
113122
GeneratedFrom: "oasdiff " + oasdiffVersion(),
114123
Vocabulary: Vocabulary{
124+
Locations: "A location is a path through the OpenAPI object model, dot-separated, with * standing " +
125+
"for a map entry (a path, a method, a media type, a property name) and x-* for a specification " +
126+
"extension: paths.*.*.requestBody.content.*.schema.maxLength names the maxLength keyword of any " +
127+
"request body schema. A claim is location:action[,action...], the edits a change covers; a claim " +
128+
"pattern may use ** to cover a location family.",
115129
Actions: map[string]string{
116130
"add": "a member is added to a collection (a property, an enum value, a response status)",
117131
"remove": "a member is removed from a collection",
@@ -126,6 +140,27 @@ func main() {
126140
"response": "the change concerns what clients receive",
127141
"none": "the change concerns neither side of the wire (metadata, lifecycle)",
128142
},
143+
Areas: map[string]string{
144+
"schema": "a schema and its keywords, wherever the schema appears",
145+
"parameters": "operation and path parameters",
146+
"requestBody": "the request body object and its media types",
147+
"responses": "the responses map, response objects, and their media types",
148+
"paths": "paths, operations, and operation metadata",
149+
"headers": "response headers",
150+
"security": "security schemes, requirements, and scopes",
151+
"tags": "tags and their metadata",
152+
"components": "the components section (compared where referenced)",
153+
},
154+
Kinds: map[string]string{
155+
"existence": "an element is added or removed",
156+
"requiredness": "required, optional, or nullable state",
157+
"mutability": "read-only or write-only state",
158+
"type": "data type or format",
159+
"constraints": "bounds such as min/max, length, items, pattern",
160+
"values": "enum, const, and default values",
161+
"structure": "composition and applicator keywords: allOf, anyOf, oneOf, discriminator, if/then/else, contains",
162+
"lifecycle": "deprecation, sunset, and stability",
163+
},
129164
Effects: map[string]string{
130165
"narrows": "the new contract rejects payloads the previous contract accepted",
131166
"widens": "the new contract accepts payloads the previous contract rejected",
@@ -147,6 +182,17 @@ func main() {
147182
"warning": "plausibly breaking, but the specification cannot decide; the finding says what is missing",
148183
"info": "provably safe for every consumer that conformed to the old contract",
149184
},
185+
Statuses: map[string]string{
186+
"covered": "one or more named changes claim the edit",
187+
"waived": "no change covers the edit and a written reason says why; the category refines it",
188+
"non-contract": "the edit cannot affect which payloads are valid (descriptions, examples, extensions)",
189+
"uncovered": "no change and no waiver; the reference implementation fails its build in this state, so the listing normally contains none",
190+
},
191+
Categories: map[string]string{
192+
"open": "a missing change, with its reason and a suggested id",
193+
"resolved-at-usage": "component definitions are compared at their referencing operations, which have their own rows",
194+
"covered-as": "the same document edit is reported under another action",
195+
},
150196
},
151197
SeverityLaw: SeverityLaw{
152198
Description: "A change's level is derived from its effect, its direction, and its guards. " +

‎openapi-changes-model.yaml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ model: OpenAPI Changes Model
44
version: 0.1.0-draft
55
generated_from: oasdiff v1.31.0
66
vocabulary:
7+
locations: 'A location is a path through the OpenAPI object model, dot-separated, with * standing for a map entry (a path, a method, a media type, a property name) and x-* for a specification extension: paths.*.*.requestBody.content.*.schema.maxLength names the maxLength keyword of any request body schema. A claim is location:action[,action...], the edits a change covers; a claim pattern may use ** to cover a location family.'
78
actions:
89
add: a member is added to a collection (a property, an enum value, a response status)
910
change: a field's value is replaced by an incomparable value
@@ -16,6 +17,25 @@ vocabulary:
1617
none: the change concerns neither side of the wire (metadata, lifecycle)
1718
request: the change concerns what clients send
1819
response: the change concerns what clients receive
20+
areas:
21+
components: the components section (compared where referenced)
22+
headers: response headers
23+
parameters: operation and path parameters
24+
paths: paths, operations, and operation metadata
25+
requestBody: the request body object and its media types
26+
responses: the responses map, response objects, and their media types
27+
schema: a schema and its keywords, wherever the schema appears
28+
security: security schemes, requirements, and scopes
29+
tags: tags and their metadata
30+
kinds:
31+
constraints: bounds such as min/max, length, items, pattern
32+
existence: an element is added or removed
33+
lifecycle: deprecation, sunset, and stability
34+
mutability: read-only or write-only state
35+
requiredness: required, optional, or nullable state
36+
structure: 'composition and applicator keywords: allOf, anyOf, oneOf, discriminator, if/then/else, contains'
37+
type: data type or format
38+
values: enum, const, and default values
1939
effects:
2040
incomparable: the change both rejects previously valid payloads and accepts previously invalid ones
2141
narrows: the new contract rejects payloads the previous contract accepted
@@ -34,6 +54,15 @@ vocabulary:
3454
error: a consumer that conformed to the old contract can stop conforming or fail
3555
info: provably safe for every consumer that conformed to the old contract
3656
warning: plausibly breaking, but the specification cannot decide; the finding says what is missing
57+
statuses:
58+
covered: one or more named changes claim the edit
59+
non-contract: the edit cannot affect which payloads are valid (descriptions, examples, extensions)
60+
uncovered: no change and no waiver; the reference implementation fails its build in this state, so the listing normally contains none
61+
waived: no change covers the edit and a written reason says why; the category refines it
62+
categories:
63+
covered-as: the same document edit is reported under another action
64+
open: a missing change, with its reason and a suggested id
65+
resolved-at-usage: component definitions are compared at their referencing operations, which have their own rows
3766
severity_law:
3867
description: 'A change''s level is derived from its effect, its direction, and its guards. Guards apply first, each nullifying or requalifying the effect on the side it speaks about; then the effect and direction decide: narrowing breaks request consumers, widening breaks response consumers, an incomparable change breaks both, and an unknown one is a warning. When a change cannot be proven safe it is reported as breaking.'
3968
guards_apply_first:

0 commit comments

Comments
 (0)