@descryy/runtime-openapi-observation 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +6 -0
- package/dist/declared-roles.d.ts +10 -16
- package/dist/declared-roles.d.ts.map +1 -1
- package/dist/declared-roles.js +10 -16
- package/dist/declared-roles.js.map +1 -1
- package/dist/endpoint-comparison.d.ts +7 -9
- package/dist/endpoint-comparison.d.ts.map +1 -1
- package/dist/endpoint-comparison.js +9 -12
- package/dist/endpoint-comparison.js.map +1 -1
- package/dist/exchange-comparison.d.ts +15 -21
- package/dist/exchange-comparison.d.ts.map +1 -1
- package/dist/exchange-comparison.js +15 -21
- package/dist/exchange-comparison.js.map +1 -1
- package/dist/schema-comparison.d.ts +13 -19
- package/dist/schema-comparison.d.ts.map +1 -1
- package/dist/schema-comparison.js +14 -22
- package/dist/schema-comparison.js.map +1 -1
- package/dist/status-bucket.d.ts +8 -12
- package/dist/status-bucket.d.ts.map +1 -1
- package/dist/status-bucket.js +8 -12
- package/dist/status-bucket.js.map +1 -1
- package/package.json +9 -4
package/LICENSE
ADDED
package/dist/declared-roles.d.ts
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Which DTO schemas a resolved `API_ENDPOINT`
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `API_ENDPOINT` itself carries no `attrs.fields`, only `attrs.method`/
|
|
8
|
-
* `attrs.pathTemplate` (`adapter.ts`, read directly rather than assumed).
|
|
2
|
+
* Which DTO schemas a resolved `API_ENDPOINT` declares, by role — a
|
|
3
|
+
* two-hop join `adapter-openapi` writes but nothing here reads yet:
|
|
4
|
+
* `API_ROUTE --SERVES_API--> API_ENDPOINT`, `API_ROUTE --USES_TYPE(roles)-->
|
|
5
|
+
* DTO`. `API_ENDPOINT` itself carries no `attrs.fields`, only
|
|
6
|
+
* `attrs.method`/`attrs.pathTemplate`.
|
|
9
7
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* DEC-115) all declare the *same contract* by construction — the endpoint is
|
|
15
|
-
* the join point precisely because it is workspace-scoped and they are not.
|
|
16
|
-
* So every DTO any serving route declares, under whichever roles it declares
|
|
17
|
-
* them, is unioned rather than picked between.
|
|
8
|
+
* Multiple serving routes are folded, not refused: several routes
|
|
9
|
+
* legitimately serving one shared `API_ENDPOINT` (repo-scoped, DEC-115)
|
|
10
|
+
* declare the same contract by construction, so every DTO any serving
|
|
11
|
+
* route declares is unioned rather than picked between.
|
|
18
12
|
*/
|
|
19
13
|
import type { IRNode } from "@descryy/ir";
|
|
20
14
|
import { type SqlDriver } from "@descryy/core";
|
|
@@ -22,6 +16,6 @@ export type SchemaRole = "request" | "response" | "errorResponse";
|
|
|
22
16
|
export type DeclaredSchemaRoles = {
|
|
23
17
|
readonly [K in SchemaRole]: readonly IRNode[];
|
|
24
18
|
};
|
|
25
|
-
/** `{request: [], response: [], errorResponse: []}`
|
|
19
|
+
/** `{request: [], response: [], errorResponse: []}` when no route serves this endpoint or none declared a `USES_TYPE` edge — a real "this operation names no schema", not an error. */
|
|
26
20
|
export declare function declaredSchemaRoles(driver: SqlDriver, endpointNodeId: string): DeclaredSchemaRoles;
|
|
27
21
|
//# sourceMappingURL=declared-roles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declared-roles.d.ts","sourceRoot":"","sources":["../src/declared-roles.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"declared-roles.d.ts","sourceRoot":"","sources":["../src/declared-roles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAE5E,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,eAAe,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAAG;IAAE,QAAQ,EAAE,CAAC,IAAI,UAAU,GAAG,SAAS,MAAM,EAAE;CAAE,CAAC;AAOpF,uLAAuL;AACvL,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,GAAG,mBAAmB,CAqBlG"}
|
package/dist/declared-roles.js
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Which DTO schemas a resolved `API_ENDPOINT`
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `API_ENDPOINT` itself carries no `attrs.fields`, only `attrs.method`/
|
|
8
|
-
* `attrs.pathTemplate` (`adapter.ts`, read directly rather than assumed).
|
|
2
|
+
* Which DTO schemas a resolved `API_ENDPOINT` declares, by role — a
|
|
3
|
+
* two-hop join `adapter-openapi` writes but nothing here reads yet:
|
|
4
|
+
* `API_ROUTE --SERVES_API--> API_ENDPOINT`, `API_ROUTE --USES_TYPE(roles)-->
|
|
5
|
+
* DTO`. `API_ENDPOINT` itself carries no `attrs.fields`, only
|
|
6
|
+
* `attrs.method`/`attrs.pathTemplate`.
|
|
9
7
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* DEC-115) all declare the *same contract* by construction — the endpoint is
|
|
15
|
-
* the join point precisely because it is workspace-scoped and they are not.
|
|
16
|
-
* So every DTO any serving route declares, under whichever roles it declares
|
|
17
|
-
* them, is unioned rather than picked between.
|
|
8
|
+
* Multiple serving routes are folded, not refused: several routes
|
|
9
|
+
* legitimately serving one shared `API_ENDPOINT` (repo-scoped, DEC-115)
|
|
10
|
+
* declare the same contract by construction, so every DTO any serving
|
|
11
|
+
* route declares is unioned rather than picked between.
|
|
18
12
|
*/
|
|
19
13
|
import { getNode, incoming, outgoing } from "@descryy/core";
|
|
20
14
|
function rolesOf(attrs) {
|
|
21
15
|
const roles = attrs?.roles;
|
|
22
16
|
return Array.isArray(roles) ? roles.filter((r) => typeof r === "string") : [];
|
|
23
17
|
}
|
|
24
|
-
/** `{request: [], response: [], errorResponse: []}`
|
|
18
|
+
/** `{request: [], response: [], errorResponse: []}` when no route serves this endpoint or none declared a `USES_TYPE` edge — a real "this operation names no schema", not an error. */
|
|
25
19
|
export function declaredSchemaRoles(driver, endpointNodeId) {
|
|
26
20
|
const result = { request: [], response: [], errorResponse: [] };
|
|
27
21
|
const seen = new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declared-roles.js","sourceRoot":"","sources":["../src/declared-roles.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"declared-roles.js","sourceRoot":"","sources":["../src/declared-roles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAkB,MAAM,eAAe,CAAC;AAM5E,SAAS,OAAO,CAAC,KAAoD;IACnE,MAAM,KAAK,GAAG,KAAK,EAAE,KAAK,CAAC;IAC3B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7F,CAAC;AAED,uLAAuL;AACvL,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,cAAsB;IAC3E,MAAM,MAAM,GAAoC,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC;IACjG,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAClF,KAAK,MAAM,SAAS,IAAI,aAAa,EAAE,CAAC;QACtC,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC5E,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;YACrC,IAAI,GAAG,KAAK,SAAS;gBAAE,SAAS,CAAC,kEAAkE;YACnG,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBACvC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,eAAe;oBAAE,SAAS;gBACpF,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;gBAChC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;oBAAE,SAAS;gBAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACd,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Resolving an observed request's method+path against
|
|
3
|
-
* `API_ENDPOINT` shapes — checklist §15's "documented
|
|
4
|
-
* "
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* because it was declared under a different verb.
|
|
2
|
+
* Resolving an observed request's method+path against declared
|
|
3
|
+
* `API_ENDPOINT` shapes — checklist §15's "documented"/"undocumented"/
|
|
4
|
+
* "wrong method" and §18's table/column-mapping analogue for OpenAPI: does
|
|
5
|
+
* the contract know this call, and if not, was the path never declared or
|
|
6
|
+
* declared under a different verb.
|
|
8
7
|
*
|
|
9
8
|
* Both underlying queries (`resolveEndpointNode`, `resolveEndpointNodesByPath`)
|
|
10
9
|
* are `@descryy/runtime-graph-correlator`'s, reused rather than duplicated —
|
|
11
|
-
* `resolveEndpointNodesByPath` exists
|
|
12
|
-
*
|
|
13
|
-
* deliberately doesn't answer on its own).
|
|
10
|
+
* `resolveEndpointNodesByPath` exists there specifically because this
|
|
11
|
+
* comparison needed a method-agnostic path query.
|
|
14
12
|
*/
|
|
15
13
|
import type { IRNode } from "@descryy/ir";
|
|
16
14
|
import type { SqlDriver } from "@descryy/core";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-comparison.d.ts","sourceRoot":"","sources":["../src/endpoint-comparison.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"endpoint-comparison.d.ts","sourceRoot":"","sources":["../src/endpoint-comparison.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,MAAM,kBAAkB;AAC5B,oEAAoE;AAClE;IAAE,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AAC/D;;;GAGG;GACD;IAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AAC/D;;;;GAIG;GACD;IACE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAC;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AACH,0GAA0G;GACxG;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,GAAG,kBAAkB,CA0BxG"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Resolving an observed request's method+path against
|
|
3
|
-
* `API_ENDPOINT` shapes — checklist §15's "documented
|
|
4
|
-
* "
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* because it was declared under a different verb.
|
|
2
|
+
* Resolving an observed request's method+path against declared
|
|
3
|
+
* `API_ENDPOINT` shapes — checklist §15's "documented"/"undocumented"/
|
|
4
|
+
* "wrong method" and §18's table/column-mapping analogue for OpenAPI: does
|
|
5
|
+
* the contract know this call, and if not, was the path never declared or
|
|
6
|
+
* declared under a different verb.
|
|
8
7
|
*
|
|
9
8
|
* Both underlying queries (`resolveEndpointNode`, `resolveEndpointNodesByPath`)
|
|
10
9
|
* are `@descryy/runtime-graph-correlator`'s, reused rather than duplicated —
|
|
11
|
-
* `resolveEndpointNodesByPath` exists
|
|
12
|
-
*
|
|
13
|
-
* deliberately doesn't answer on its own).
|
|
10
|
+
* `resolveEndpointNodesByPath` exists there specifically because this
|
|
11
|
+
* comparison needed a method-agnostic path query.
|
|
14
12
|
*/
|
|
15
13
|
import { resolveEndpointNode, resolveEndpointNodesByPath } from "@descryy/runtime-graph-correlator";
|
|
16
14
|
export function compareObservedEndpoint(driver, observed) {
|
|
@@ -21,9 +19,8 @@ export function compareObservedEndpoint(driver, observed) {
|
|
|
21
19
|
if (exact.outcome === "ambiguous") {
|
|
22
20
|
return { outcome: "ambiguous", candidates: exact.candidates, reason: exact.reason };
|
|
23
21
|
}
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
// question resolveEndpointNode's own method filter cannot answer.
|
|
22
|
+
// not-found: exact method+path isn't declared. Whether the path is
|
|
23
|
+
// declared under another method is a separate question.
|
|
27
24
|
const byPath = resolveEndpointNodesByPath(driver, observed.path);
|
|
28
25
|
if (byPath.nodes.length === 0) {
|
|
29
26
|
return { outcome: "undocumented", reason: exact.reason };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-comparison.js","sourceRoot":"","sources":["../src/endpoint-comparison.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"endpoint-comparison.js","sourceRoot":"","sources":["../src/endpoint-comparison.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AA6BpG,MAAM,UAAU,uBAAuB,CAAC,MAAiB,EAAE,QAAyB;IAClF,MAAM,KAAK,GAAG,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE1E,IAAI,KAAK,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IACzD,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IACtF,CAAC;IAED,mEAAmE;IACnE,wDAAwD;IACxD,MAAM,MAAM,GAAG,0BAA0B,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjE,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IAC3D,CAAC;IAED,MAAM,oBAAoB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAChH,OAAO;QACL,OAAO,EAAE,cAAc;QACvB,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE;QAC7C,oBAAoB;QACpB,MAAM,EACJ,GAAG,QAAQ,CAAC,IAAI,sBAAsB,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ;YAC7E,GAAG,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,mDAAmD;KACtF,CAAC;AACJ,CAAC"}
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ties `compareObservedEndpoint`, `classifyStatus`, `declaredSchemaRoles`
|
|
3
|
-
* `compareBodyAgainstSchema` together into
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* when a body was observed — does that body's own fields match that role's
|
|
7
|
-
* declared shape.
|
|
2
|
+
* Ties `compareObservedEndpoint`, `classifyStatus`, `declaredSchemaRoles`
|
|
3
|
+
* and `compareBodyAgainstSchema` together into checklist §15's comparison:
|
|
4
|
+
* is the call documented, did its outcome's class match a declared schema
|
|
5
|
+
* role, and — when a body was observed — does it match that role's shape.
|
|
8
6
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* cannot say "this contract expected 200, not 201." Reported as
|
|
15
|
-
* `statusSurprising: boolean | null`, never as a confident status-code
|
|
16
|
-
* mismatch it has no basis for.
|
|
7
|
+
* What "surprising" claims and doesn't: the contract carries schemas by
|
|
8
|
+
* *role*, never a specific status code (§14/§18). So this can say "the
|
|
9
|
+
* contract declares zero schemas for outcomes shaped like this one" but
|
|
10
|
+
* never "expected 200, not 201." Reported as `statusSurprising: boolean |
|
|
11
|
+
* null`, never a status-code mismatch it has no basis for.
|
|
17
12
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* would report every field of a real, correct error response as missing.
|
|
13
|
+
* Request and response are compared against different roles on purpose: a
|
|
14
|
+
* request body is always checked against `request`; a response body
|
|
15
|
+
* against whichever role the observed status bucket expects (`response`
|
|
16
|
+
* for success, `errorResponse` for an error) — comparing an error body
|
|
17
|
+
* against the success DTO would report a correct error response as all
|
|
18
|
+
* fields missing.
|
|
25
19
|
*/
|
|
26
20
|
import type { SqlDriver } from "@descryy/core";
|
|
27
21
|
import { type EndpointComparison, type ObservedRequest } from "./endpoint-comparison.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exchange-comparison.d.ts","sourceRoot":"","sources":["../src/exchange-comparison.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"exchange-comparison.d.ts","sourceRoot":"","sources":["../src/exchange-comparison.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAA2B,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAClH,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAyC,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAA4B,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEzF,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,6IAA6I;IAC7I,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,+HAA+H;IAC/H,QAAQ,CAAC,aAAa,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnD;;;;;;;OAOG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1C,4IAA4I;IAC5I,QAAQ,CAAC,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChD,0IAA0I;IAC1I,QAAQ,CAAC,cAAc,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAClD;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,GAAG,kBAAkB,CAwBzG"}
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ties `compareObservedEndpoint`, `classifyStatus`, `declaredSchemaRoles`
|
|
3
|
-
* `compareBodyAgainstSchema` together into
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* when a body was observed — does that body's own fields match that role's
|
|
7
|
-
* declared shape.
|
|
2
|
+
* Ties `compareObservedEndpoint`, `classifyStatus`, `declaredSchemaRoles`
|
|
3
|
+
* and `compareBodyAgainstSchema` together into checklist §15's comparison:
|
|
4
|
+
* is the call documented, did its outcome's class match a declared schema
|
|
5
|
+
* role, and — when a body was observed — does it match that role's shape.
|
|
8
6
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* cannot say "this contract expected 200, not 201." Reported as
|
|
15
|
-
* `statusSurprising: boolean | null`, never as a confident status-code
|
|
16
|
-
* mismatch it has no basis for.
|
|
7
|
+
* What "surprising" claims and doesn't: the contract carries schemas by
|
|
8
|
+
* *role*, never a specific status code (§14/§18). So this can say "the
|
|
9
|
+
* contract declares zero schemas for outcomes shaped like this one" but
|
|
10
|
+
* never "expected 200, not 201." Reported as `statusSurprising: boolean |
|
|
11
|
+
* null`, never a status-code mismatch it has no basis for.
|
|
17
12
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* would report every field of a real, correct error response as missing.
|
|
13
|
+
* Request and response are compared against different roles on purpose: a
|
|
14
|
+
* request body is always checked against `request`; a response body
|
|
15
|
+
* against whichever role the observed status bucket expects (`response`
|
|
16
|
+
* for success, `errorResponse` for an error) — comparing an error body
|
|
17
|
+
* against the success DTO would report a correct error response as all
|
|
18
|
+
* fields missing.
|
|
25
19
|
*/
|
|
26
20
|
import { compareObservedEndpoint } from "./endpoint-comparison.js";
|
|
27
21
|
import { declaredSchemaRoles } from "./declared-roles.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exchange-comparison.js","sourceRoot":"","sources":["../src/exchange-comparison.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"exchange-comparison.js","sourceRoot":"","sources":["../src/exchange-comparison.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,uBAAuB,EAAiD,MAAM,0BAA0B,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAA4B,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAqB,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,wBAAwB,EAAyB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Detail`
|
|
6
|
-
* `adapter-openapi`'s
|
|
7
|
-
* derived here.
|
|
2
|
+
* §15's open row: an observed request/response BODY compared against a
|
|
3
|
+
* declared DTO's fields, not just which DTOs a role names
|
|
4
|
+
* (`declaredSchemaRoles` stops at "here are the schemas"). Reads
|
|
5
|
+
* `DTO.attrs.fieldDetail` (`{name, nullable, required, type?}[]`), written
|
|
6
|
+
* by `adapter-openapi`'s `document.ts` directly from the contract.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* already captures) — parsing and shape-checking are this file's job, sourcing
|
|
12
|
-
* the bytes is not, matching every other comparator in this package.
|
|
8
|
+
* Takes a raw body already in hand — sourcing the bytes isn't this file's
|
|
9
|
+
* job, matching every other comparator in this package.
|
|
13
10
|
*
|
|
14
|
-
*
|
|
11
|
+
* Extra fields are never reported: this adapter doesn't capture
|
|
15
12
|
* `additionalProperties`, so "the body has a field the contract doesn't
|
|
16
|
-
* mention"
|
|
17
|
-
* would be inventing a stricter contract than the one that was published.
|
|
13
|
+
* mention" isn't a claim the contract supports either way.
|
|
18
14
|
*
|
|
19
|
-
*
|
|
20
|
-
* `declaredSchemaRoles` unions across
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* comparing the body against whichever came first would silently prefer one
|
|
24
|
-
* repository's contract over another's.
|
|
15
|
+
* A role naming more than one DTO refuses rather than picks one:
|
|
16
|
+
* `declaredSchemaRoles` unions across serving routes (DEC-115) — when they
|
|
17
|
+
* name different schemas for the same role, picking one would silently
|
|
18
|
+
* prefer one repository's contract over another's.
|
|
25
19
|
*/
|
|
26
20
|
import type { IRNode } from "@descryy/ir";
|
|
27
21
|
export interface FieldDetail {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-comparison.d.ts","sourceRoot":"","sources":["../src/schema-comparison.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema-comparison.d.ts","sourceRoot":"","sources":["../src/schema-comparison.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AM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AAC3F,8EAA8E;GAC5E;IAAE,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC7F;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,CAAC;AAwC7G,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,gBAAgB,CA6DzH"}
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* declared DTO's fields, not
|
|
4
|
-
* (`declaredSchemaRoles
|
|
5
|
-
* `DTO.attrs.fieldDetail`
|
|
6
|
-
* `adapter-openapi`'s
|
|
7
|
-
* derived here.
|
|
2
|
+
* §15's open row: an observed request/response BODY compared against a
|
|
3
|
+
* declared DTO's fields, not just which DTOs a role names
|
|
4
|
+
* (`declaredSchemaRoles` stops at "here are the schemas"). Reads
|
|
5
|
+
* `DTO.attrs.fieldDetail` (`{name, nullable, required, type?}[]`), written
|
|
6
|
+
* by `adapter-openapi`'s `document.ts` directly from the contract.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* already captures) — parsing and shape-checking are this file's job, sourcing
|
|
12
|
-
* the bytes is not, matching every other comparator in this package.
|
|
8
|
+
* Takes a raw body already in hand — sourcing the bytes isn't this file's
|
|
9
|
+
* job, matching every other comparator in this package.
|
|
13
10
|
*
|
|
14
|
-
*
|
|
11
|
+
* Extra fields are never reported: this adapter doesn't capture
|
|
15
12
|
* `additionalProperties`, so "the body has a field the contract doesn't
|
|
16
|
-
* mention"
|
|
17
|
-
* would be inventing a stricter contract than the one that was published.
|
|
13
|
+
* mention" isn't a claim the contract supports either way.
|
|
18
14
|
*
|
|
19
|
-
*
|
|
20
|
-
* `declaredSchemaRoles` unions across
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* comparing the body against whichever came first would silently prefer one
|
|
24
|
-
* repository's contract over another's.
|
|
15
|
+
* A role naming more than one DTO refuses rather than picks one:
|
|
16
|
+
* `declaredSchemaRoles` unions across serving routes (DEC-115) — when they
|
|
17
|
+
* name different schemas for the same role, picking one would silently
|
|
18
|
+
* prefer one repository's contract over another's.
|
|
25
19
|
*/
|
|
26
20
|
function isFieldDetail(value) {
|
|
27
21
|
if (typeof value !== "object" || value === null)
|
|
@@ -104,9 +98,7 @@ export function compareBodyAgainstSchema(schemas, rawBody) {
|
|
|
104
98
|
if (field.type === undefined)
|
|
105
99
|
continue;
|
|
106
100
|
const check = TYPE_CHECKS[field.type];
|
|
107
|
-
//
|
|
108
|
-
// this map) is not checked, rather than silently treated as a match —
|
|
109
|
-
// there is nothing here yet to compare it against.
|
|
101
|
+
// Unrecognised declared type isn't checked, not silently treated as a match.
|
|
110
102
|
if (check !== undefined && !check(value)) {
|
|
111
103
|
mismatches.push({
|
|
112
104
|
kind: "type-mismatch",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-comparison.js","sourceRoot":"","sources":["../src/schema-comparison.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema-comparison.js","sourceRoot":"","sources":["../src/schema-comparison.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA8BH,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QA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CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAC9G,CAAC"}
|
package/dist/status-bucket.d.ts
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A real HTTP status classified into the class an OpenAPI document
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* contract itself does, rather than inventing a numeric comparison the
|
|
7
|
-
* document was never asked to support.
|
|
2
|
+
* A real HTTP status classified into the class an OpenAPI document has a
|
|
3
|
+
* role vocabulary for. `adapter-openapi`'s `Operation` carries
|
|
4
|
+
* `responseSchemas` (2xx) and `errorSchemas` (non-2xx) — two roles, not
|
|
5
|
+
* eleven status codes — so this stops at the contract's own resolution.
|
|
8
6
|
*/
|
|
9
7
|
export declare const STATUS_BUCKETS: readonly ["informational", "success", "redirect", "client-error", "server-error"];
|
|
10
8
|
export type StatusBucket = (typeof STATUS_BUCKETS)[number];
|
|
11
9
|
export declare function classifyStatus(status: number): StatusBucket;
|
|
12
10
|
/**
|
|
13
|
-
* The DTO role
|
|
14
|
-
* `"
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* bucket the contract was never asked about would read as a finding where
|
|
18
|
-
* there is only an unmodelled case.
|
|
11
|
+
* The DTO role a bucket corresponds to (`"request"`/`"response"`/
|
|
12
|
+
* `"errorResponse"`) — `null` for informational/redirect, which
|
|
13
|
+
* `adapter-openapi` never assigns a role to. Refused rather than guessed:
|
|
14
|
+
* "no declared schema" for an unmodelled bucket would read as a finding.
|
|
19
15
|
*/
|
|
20
16
|
export declare function expectedRoleForBucket(bucket: StatusBucket): "response" | "errorResponse" | null;
|
|
21
17
|
//# sourceMappingURL=status-bucket.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-bucket.d.ts","sourceRoot":"","sources":["../src/status-bucket.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"status-bucket.d.ts","sourceRoot":"","sources":["../src/status-bucket.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,cAAc,mFAAoF,CAAC;AAChH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAM3D;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,GAAG,eAAe,GAAG,IAAI,CAI/F"}
|
package/dist/status-bucket.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A real HTTP status classified into the class an OpenAPI document
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* contract itself does, rather than inventing a numeric comparison the
|
|
7
|
-
* document was never asked to support.
|
|
2
|
+
* A real HTTP status classified into the class an OpenAPI document has a
|
|
3
|
+
* role vocabulary for. `adapter-openapi`'s `Operation` carries
|
|
4
|
+
* `responseSchemas` (2xx) and `errorSchemas` (non-2xx) — two roles, not
|
|
5
|
+
* eleven status codes — so this stops at the contract's own resolution.
|
|
8
6
|
*/
|
|
9
7
|
export const STATUS_BUCKETS = ["informational", "success", "redirect", "client-error", "server-error"];
|
|
10
8
|
export function classifyStatus(status) {
|
|
@@ -19,12 +17,10 @@ export function classifyStatus(status) {
|
|
|
19
17
|
return "server-error";
|
|
20
18
|
}
|
|
21
19
|
/**
|
|
22
|
-
* The DTO role
|
|
23
|
-
* `"
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* bucket the contract was never asked about would read as a finding where
|
|
27
|
-
* there is only an unmodelled case.
|
|
20
|
+
* The DTO role a bucket corresponds to (`"request"`/`"response"`/
|
|
21
|
+
* `"errorResponse"`) — `null` for informational/redirect, which
|
|
22
|
+
* `adapter-openapi` never assigns a role to. Refused rather than guessed:
|
|
23
|
+
* "no declared schema" for an unmodelled bucket would read as a finding.
|
|
28
24
|
*/
|
|
29
25
|
export function expectedRoleForBucket(bucket) {
|
|
30
26
|
if (bucket === "success")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-bucket.js","sourceRoot":"","sources":["../src/status-bucket.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"status-bucket.js","sourceRoot":"","sources":["../src/status-bucket.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,CAAU,CAAC;AAGhH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;QAAE,OAAO,eAAe,CAAC;IAC1D,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;QAAE,OAAO,SAAS,CAAC;IACpD,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;QAAE,OAAO,UAAU,CAAC;IACrD,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;QAAE,OAAO,cAAc,CAAC;IACzD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAoB;IACxD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,UAAU,CAAC;IAC5C,IAAI,MAAM,KAAK,cAAc,IAAI,MAAM,KAAK,cAAc;QAAE,OAAO,eAAe,CAAC;IACnF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descryy/runtime-openapi-observation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenAPI runtime contract comparison (plan \u00a715/\u00a718): a real observed HTTP exchange, compared against the graph's already-declared API_ENDPOINT/DTO shapes -- documented/undocumented/wrong-method resolution and status-bucket-vs-declared-role comparison.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/descryhq-wq/descry-runtime.git",
|
|
10
|
+
"directory": "packages/openapi-observation"
|
|
11
|
+
},
|
|
7
12
|
"engines": {
|
|
8
13
|
"node": ">=22.5"
|
|
9
14
|
},
|
|
@@ -24,9 +29,9 @@
|
|
|
24
29
|
"build": "tsc -b"
|
|
25
30
|
},
|
|
26
31
|
"dependencies": {
|
|
27
|
-
"@descryy/ir": "0.
|
|
28
|
-
"@descryy/core": "0.
|
|
29
|
-
"@descryy/runtime-graph-correlator": "0.
|
|
32
|
+
"@descryy/ir": "0.5.0",
|
|
33
|
+
"@descryy/core": "0.5.0",
|
|
34
|
+
"@descryy/runtime-graph-correlator": "0.4.0"
|
|
30
35
|
},
|
|
31
36
|
"devDependencies": {
|
|
32
37
|
"@descry/adapter-openapi": "file:../../../descry-adapters/packages/adapter-openapi",
|