You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Schema Inaccuracy] Equivalent templated paths under /orgs/{org}/attestations/ and /users/{username}/attestations/ #7367
The description defines two pairs of templated paths that differ only in the name of the last template expression:
Path
Operation
/orgs/{org}/attestations/{attestation_id}
DELETEorgs/delete-attestations-by-id
/orgs/{org}/attestations/{subject_digest}
GETorgs/list-attestations
/users/{username}/attestations/{attestation_id}
DELETEusers/delete-attestations-by-id
/users/{username}/attestations/{subject_digest}
GETusers/list-attestations
The OpenAPI Specification (3.0.3, Paths Object) says: "Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical." Each pair above has the same hierarchy, so a router or generator that matches requests by path template sees one path with two definitions. (/repos/{owner}/{repo}/attestations/{subject_digest} has no such counterpart.)
Checked at commit 755ee33, descriptions/api.github.com/api.github.com.json.
Expected
Each hierarchy appears once in paths. For example, one path item per pair with a single template expression name, holding both the GET and the DELETE operation and declaring the parameter at the operation level.
Reproduction Steps
curl -sL https://raw.githubusercontent.com/github/rest-api-description/755ee33b4a81d51f6f07a902cce26cbec3b822f2/descriptions/api.github.com/api.github.com.json -o api.github.com.json
node -e 'const paths = Object.keys(JSON.parse(require("fs").readFileSync("api.github.com.json","utf8")).paths);const seen = new Map();for (const p of paths) { const k = p.replace(/\{[^}]+\}/g, "{}"); if (seen.has(k)) console.log(seen.get(k), "<->", p); else seen.set(k, p); }'
Activity