@mitre/hdf-openapi 0.0.0-stage → 3.8.0-next.42532249979.1
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.md +55 -0
- package/README.md +133 -2
- package/dist/hdf-components.oas.json +8028 -0
- package/dist/hdf-components.oas.yaml +5894 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5863 -0
- package/dist/index.js.map +1 -0
- package/dist/problems.json +114 -0
- package/dist/problems.yaml +125 -0
- package/package.json +64 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
interface JsonSchema {
|
|
2
|
+
[key: string]: unknown;
|
|
3
|
+
}
|
|
4
|
+
interface ComponentsDocument {
|
|
5
|
+
openapi: string;
|
|
6
|
+
info: {
|
|
7
|
+
title: string;
|
|
8
|
+
version: string;
|
|
9
|
+
description: string;
|
|
10
|
+
license: {
|
|
11
|
+
name: string;
|
|
12
|
+
identifier: string;
|
|
13
|
+
};
|
|
14
|
+
contact: {
|
|
15
|
+
name: string;
|
|
16
|
+
url: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
jsonSchemaDialect: string;
|
|
20
|
+
components: {
|
|
21
|
+
schemas: Record<string, JsonSchema>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** The bundler's own list (hdf-schema/src/bundle-schemas.ts), in its order. */
|
|
25
|
+
export declare const MAIN_SCHEMAS: readonly ["hdf-results.schema.json", "hdf-baseline.schema.json", "hdf-comparison.schema.json", "hdf-system.schema.json", "hdf-plan.schema.json", "hdf-amendments.schema.json", "hdf-evidence-package.schema.json", "hdf-requirement-change-event.schema.json"];
|
|
26
|
+
export declare const ROOT_COMPONENT_NAMES: Record<string, string>;
|
|
27
|
+
/** Named definitions across the bundles, excluding the eight roots. */
|
|
28
|
+
export declare const EXPECTED_DEFINITIONS = 118;
|
|
29
|
+
/**
|
|
30
|
+
* Lifts one component out of the components document as a schema that validates on its
|
|
31
|
+
* own — the inverse of the components transform, and the only way to check that the
|
|
32
|
+
* transform preserved meaning rather than merely producing well-formed output.
|
|
33
|
+
*
|
|
34
|
+
* The closure is walked transitively rather than copying every component, so what comes
|
|
35
|
+
* back is the subgraph the named component actually depends on. A component that dragged
|
|
36
|
+
* in the whole document would make the test pass for the wrong reason.
|
|
37
|
+
*
|
|
38
|
+
* Validate the result with a 2020-12 engine. This repository's own validators are
|
|
39
|
+
* draft-07 and ignore `unevaluatedProperties` (ADR-0009 §5), so they would accept
|
|
40
|
+
* documents the schema text rejects.
|
|
41
|
+
*/
|
|
42
|
+
export declare function extractStandaloneSchema(doc: ComponentsDocument, name: string): JsonSchema;
|
|
43
|
+
/** Who owns the condition: the mcperr taxonomy, ADR-0008 §3's conventions, or the service. */
|
|
44
|
+
type ProblemOwner = 'taxonomy' | 'convention' | 'service';
|
|
45
|
+
interface ProblemDoc {
|
|
46
|
+
/** The mcperr code this type maps, where one does (ADR-0010 §6). */
|
|
47
|
+
code?: string;
|
|
48
|
+
title: string;
|
|
49
|
+
status: number;
|
|
50
|
+
owner: ProblemOwner;
|
|
51
|
+
cause: string;
|
|
52
|
+
remedy: string;
|
|
53
|
+
}
|
|
54
|
+
/** Loads the problem-type documentation, refusing a malformed or incomplete entry. */
|
|
55
|
+
export declare function loadProblemDocs(file?: string): Record<string, ProblemDoc>;
|
|
56
|
+
/** Where the hosted problem-type pages live, which every `type` value dereferences to. */
|
|
57
|
+
export declare const PROBLEM_BASE = "https://mitre.github.io/hdf-libs/problems";
|
|
58
|
+
/**
|
|
59
|
+
* ADR-0010 §6's code-to-status-and-type mapping, derived from problems.yaml rather than
|
|
60
|
+
* restated beside it — §6 says the mapping exists exactly once, and that file is where.
|
|
61
|
+
*/
|
|
62
|
+
export declare function problemTypes(docs?: Record<string, ProblemDoc>): Record<string, {
|
|
63
|
+
status: number;
|
|
64
|
+
type: string;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* The codes ADR-0010 §6 marks `never`. Recorded rather than silently dropped: each is a
|
|
68
|
+
* `file`-adapter concern with no HTTP surface, and TRUNCATED is dead in the MCP too.
|
|
69
|
+
*/
|
|
70
|
+
export declare const UNMAPPED_CODES: string[];
|
|
71
|
+
interface ExampleFault {
|
|
72
|
+
index: number;
|
|
73
|
+
errors: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Faults in a schema's own examples. An empty array means every example validates.
|
|
77
|
+
*
|
|
78
|
+
* `references` supplies the components an example's schema may `$ref` — the ingest request
|
|
79
|
+
* points at the eight document roots, so without them it cannot compile.
|
|
80
|
+
*/
|
|
81
|
+
export declare function validateExample(schema: Record<string, unknown>, references?: Record<string, unknown>): ExampleFault[];
|
|
82
|
+
export type { ComponentsDocument, ExampleFault, JsonSchema, ProblemDoc, ProblemOwner };
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components.ts","../src/extract.ts","../src/problems.ts","../src/validate-example.ts"],"mappings":"A,UAAiB;GACd;;UAGc;EACf;EACA;IACE;IACA;IACA;IACA;MAAW;MAAc;;IACzB;MAAW;MAAc;;;EAE3B;EACA;IAAc,SAAS,eAAe;;;;qBAI3B;qBAWA,sBAAsB;;qBAYtB;;;;;;;;;;;;;;wBCWG,wBAAwB,KAAK,oBAAoB,eAAe;;KC5CpE;UAEK;;EAEf;EACA;EACA;EACA,OAAO;EACP;EACA;;;wBAac,gBAAgB,gBAAqC,eAAe;;qBA2CvE;;;;;wBAMG,aAAa,OAAI,eAAA,cAAuB;EAAiB;EAAgB;;;;;;qBAY5E;UCjFI;EACf;EACA;;;;;;;;wBASc,gBACd,QAAQ,yBACR,aAAY,0BACX"}
|