gasp-ossie-validator 0.1.0__tar.gz

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.
@@ -0,0 +1,3 @@
1
+ __pycache__/
2
+ *.pyc
3
+ dist/
@@ -0,0 +1,183 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and the Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and subsequently
61
+ incorporated within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or a Contribution
81
+ incorporated within the Work constitutes patent or contributory patent
82
+ infringement, then any patent licenses granted to You under this License
83
+ for that Work shall terminate as of the date such litigation is filed.
84
+
85
+ 4. Redistribution. You may reproduce and distribute copies of the
86
+ Work or Derivative Works thereof in any medium, with or without
87
+ modifications, and in Source or Object form, provided that You
88
+ meet the following conditions:
89
+
90
+ (a) You must give any other recipients of the Work or
91
+ Derivative Works a copy of this License; and
92
+
93
+ (b) You must cause any modified files to carry prominent notices
94
+ stating that You changed the files; and
95
+
96
+ (c) You must retain, in the Source form of any Derivative Works
97
+ that You distribute, all copyright, patent, trademark, and
98
+ attribution notices from the Source form of the Work,
99
+ excluding those notices that do not pertain to any part of
100
+ the Derivative Works; and
101
+
102
+ (d) If the Work includes a "NOTICE" text file, You must include a
103
+ readable copy of the attribution notices contained within such
104
+ NOTICE file, in at least one of the following places: within a
105
+ Derivative Works that You distribute, in the Source form or
106
+ documentation, if provided along with the Derivative Works, or,
107
+ within a display generated by the Derivative Works, if and
108
+ wherever such third-party notices normally appear. The contents
109
+ of the NOTICE file are for informational purposes only and
110
+ do not modify the License. You may add Your own attribution
111
+ notices within Derivative Works that You distribute, alongside
112
+ or as an addendum to the NOTICE text from the Work, provided
113
+ that such additional attribution notices cannot be construed
114
+ as modifying the License.
115
+
116
+ You may add Your own license statement for Your modifications and
117
+ may provide additional grant of rights to use, copy, modify, and
118
+ distribute those modifications or such Derivative Works as a whole,
119
+ under terms You choose, provided Your use, reproduction, and
120
+ distribution of the Work otherwise complies with the conditions
121
+ stated in this License.
122
+
123
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
124
+ any Contribution intentionally submitted for inclusion in the Work
125
+ by You to the Licensor shall be under the terms and conditions of
126
+ this License, without any additional terms or conditions.
127
+ Notwithstanding the above, nothing herein shall supersede or modify
128
+ the terms of any separate license agreement you may have executed
129
+ with Licensor regarding such Contributions.
130
+
131
+ 6. Trademarks. This License does not grant permission to use the trade
132
+ names, trademarks, service marks, or product names of the Licensor,
133
+ except as required for reasonable and customary use in describing the
134
+ origin of the Work and reproducing the content of the NOTICE file.
135
+
136
+ 7. Disclaimer of Warranty. Unless required by applicable law or
137
+ agreed to in writing, Licensor provides the Work (and each
138
+ Contributor provides its Contributions) on an "AS IS" BASIS,
139
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
140
+ implied, including, without limitation, any warranties or conditions
141
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
142
+ PARTICULAR PURPOSE. You are solely responsible for determining the
143
+ appropriateness of using or reproducing the Work and assume any
144
+ risks associated with Your exercise of permissions under this License.
145
+
146
+ 8. Limitation of Liability. In no event and under no legal theory,
147
+ whether in tort (including negligence), contract, or otherwise,
148
+ unless required by applicable law (such as deliberate and grossly
149
+ negligent acts) or agreed to in writing, shall any Contributor be
150
+ liable to You for damages, including any direct, indirect, special,
151
+ incidental, or exemplary damages of any character arising as a
152
+ result of this License or out of the use or inability to use the
153
+ Work (including but not limited to damages for loss of goodwill,
154
+ work stoppage, computer failure or malfunction, or all other
155
+ commercial damages or losses), even if such Contributor has been
156
+ advised of the possibility of such damages.
157
+
158
+ 9. Accepting Warranty or Additional Liability. While redistributing
159
+ the Work or Derivative Works thereof, You may choose to offer,
160
+ and charge a fee for, acceptance of support, warranty, indemnity,
161
+ or other liability obligations and/or rights consistent with this
162
+ License. However, in accepting such obligations, You may act only
163
+ on Your own behalf and on Your sole responsibility, not on behalf
164
+ of any other Contributor, and only if You agree to indemnify,
165
+ defend, and hold each Contributor harmless for any liability
166
+ incurred by, or claims asserted against, such Contributor by reason
167
+ of your accepting any such warranty or additional liability.
168
+
169
+ END OF TERMS AND CONDITIONS
170
+
171
+ Copyright 2025-present 403page labs (https://403.ie)
172
+
173
+ Licensed under the Apache License, Version 2.0 (the "License");
174
+ you may not use this file except in compliance with the License.
175
+ You may obtain a copy of the License at
176
+
177
+ http://www.apache.org/licenses/LICENSE-2.0
178
+
179
+ Unless required by applicable law or agreed to in writing, software
180
+ distributed under the License is distributed on an "AS IS" BASIS,
181
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
182
+ See the License for the specific language governing permissions and
183
+ limitations under the License.
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.5
2
+ Name: gasp-ossie-validator
3
+ Version: 0.1.0
4
+ Summary: Checks the GASP payloads in an Apache Ossie document against the GASP extension schema, as a vendor validator for validation/validate.py --vendor GASP
5
+ Project-URL: Homepage, https://gaspwiki.com/downloads/ossie/
6
+ Project-URL: Repository, https://github.com/GASP-Standard/standard
7
+ Project-URL: Schema, https://gaspwiki.com/schemas/gasp-ossie-extension-v1.json
8
+ Author: Gareth O'Shea
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: apache-ossie,gasp,ossie,saas-metrics,semantic-model,validation
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: jsonschema>=4.26.0
21
+ Description-Content-Type: text/markdown
22
+
23
+ # gasp-ossie-validator
24
+
25
+ The GASP Standard's vendor validator for [Apache Ossie](https://github.com/apache/ossie) (incubating) documents.
26
+
27
+ Every Ossie document GASP writes carries `nonportable_extensions` entries with `vendor_name: GASP`. The upstream validator checks that each entry's `data` is an object and leaves its contents to the vendor. Named with `--vendor GASP`, it hands each GASP payload to this package, which validates it against the published GASP extension schema, [`gasp-ossie-extension-v1.json`](https://gaspwiki.com/schemas/gasp-ossie-extension-v1.json), by the site the payload sits on.
28
+
29
+ | Site | Schema definition |
30
+ |---|---|
31
+ | The semantic model | `ModelExtension` |
32
+ | A dataset | `DatasetExtension` |
33
+ | A metric | `MetricExtension` |
34
+ | The mapping | `MappingExtension` |
35
+ | A field or a relationship | none: GASP defines no extension there, so a GASP payload is reported |
36
+
37
+ ## Run
38
+
39
+ The validator is `validation/validate.py` in a clone of [apache/ossie](https://github.com/apache/ossie) at or after commit `b47f6ea` (2026-11-12, #697). `--with` installs this package from PyPI for the run:
40
+
41
+ ```bash
42
+ uv run --with gasp-ossie-validator validation/validate.py --vendor GASP path/to/semantic_model.yaml
43
+ uv run --with gasp-ossie-validator validation/validate.py --vendor GASP --schema ontology/mapping.json path/to/mapping.yaml
44
+ ```
45
+
46
+ A clone of [GASP-Standard/standard](https://github.com/GASP-Standard/standard) holds a pinned copy of the validator in `gasp-wiki-mcp/ossie-validator/` and this package beside it, so the same run works there from the source:
47
+
48
+ ```bash
49
+ cd gasp-wiki-mcp/ossie-validator
50
+ uv run --with ../gasp-ossie-validator validation/validate.py --vendor GASP path/to/semantic_model.yaml
51
+ ```
52
+
53
+ A finding is an error, named by vendor and site:
54
+
55
+ ```
56
+ [Vendor GASP] Dataset 'revenue_event' in model 'GASP reference model': `/` must NOT have additional properties: `colour`
57
+ ```
58
+
59
+ The vendor checks run on a document that passed the Ossie schema and the validator's other checks. An ontology document carries no extensions, so there is nothing to hand over.
60
+
61
+ ## How it is wired
62
+
63
+ `pyproject.toml` registers `gasp_ossie_validator:check` under the entry point group `ossie.vendor_validators` with the name `GASP`, the token GASP uses as `vendor_name`. `check(payload, site)` returns one message per finding: a JSON pointer into the payload and what is wrong there. The messages read like the ones the TypeScript check in `gasp-wiki-mcp/src/ossie/check.ts` writes for the same payload, which `validate_mapping` and `compile_model` report.
64
+
65
+ The schema inside the package is a copy of `standard/gasp-ossie-extension-v1.json`, written by `npm run derive` in `gasp-wiki-mcp`; `npm run derive:check` fails when the two differ. `gasp-wiki-mcp/test/ossie-vendor.test.ts` runs every GASP export through the vendored validator with `--vendor GASP` and checks that planted bad payloads are named at their sites.
66
+
67
+ Releases go to [PyPI](https://pypi.org/project/gasp-ossie-validator/) from the workflow `publish-ossie-validator.yml` in GASP-Standard/standard, through trusted publishing, so no token is stored. The workflow builds the package, runs the built wheel over the published GASP files and uploads it. The package sits outside the `gasp-standard-mcp` npm tarball.
68
+
69
+ ## Licence
70
+
71
+ Apache License 2.0, as the rest of `gasp-wiki-mcp`.
@@ -0,0 +1,49 @@
1
+ # gasp-ossie-validator
2
+
3
+ The GASP Standard's vendor validator for [Apache Ossie](https://github.com/apache/ossie) (incubating) documents.
4
+
5
+ Every Ossie document GASP writes carries `nonportable_extensions` entries with `vendor_name: GASP`. The upstream validator checks that each entry's `data` is an object and leaves its contents to the vendor. Named with `--vendor GASP`, it hands each GASP payload to this package, which validates it against the published GASP extension schema, [`gasp-ossie-extension-v1.json`](https://gaspwiki.com/schemas/gasp-ossie-extension-v1.json), by the site the payload sits on.
6
+
7
+ | Site | Schema definition |
8
+ |---|---|
9
+ | The semantic model | `ModelExtension` |
10
+ | A dataset | `DatasetExtension` |
11
+ | A metric | `MetricExtension` |
12
+ | The mapping | `MappingExtension` |
13
+ | A field or a relationship | none: GASP defines no extension there, so a GASP payload is reported |
14
+
15
+ ## Run
16
+
17
+ The validator is `validation/validate.py` in a clone of [apache/ossie](https://github.com/apache/ossie) at or after commit `b47f6ea` (2026-11-12, #697). `--with` installs this package from PyPI for the run:
18
+
19
+ ```bash
20
+ uv run --with gasp-ossie-validator validation/validate.py --vendor GASP path/to/semantic_model.yaml
21
+ uv run --with gasp-ossie-validator validation/validate.py --vendor GASP --schema ontology/mapping.json path/to/mapping.yaml
22
+ ```
23
+
24
+ A clone of [GASP-Standard/standard](https://github.com/GASP-Standard/standard) holds a pinned copy of the validator in `gasp-wiki-mcp/ossie-validator/` and this package beside it, so the same run works there from the source:
25
+
26
+ ```bash
27
+ cd gasp-wiki-mcp/ossie-validator
28
+ uv run --with ../gasp-ossie-validator validation/validate.py --vendor GASP path/to/semantic_model.yaml
29
+ ```
30
+
31
+ A finding is an error, named by vendor and site:
32
+
33
+ ```
34
+ [Vendor GASP] Dataset 'revenue_event' in model 'GASP reference model': `/` must NOT have additional properties: `colour`
35
+ ```
36
+
37
+ The vendor checks run on a document that passed the Ossie schema and the validator's other checks. An ontology document carries no extensions, so there is nothing to hand over.
38
+
39
+ ## How it is wired
40
+
41
+ `pyproject.toml` registers `gasp_ossie_validator:check` under the entry point group `ossie.vendor_validators` with the name `GASP`, the token GASP uses as `vendor_name`. `check(payload, site)` returns one message per finding: a JSON pointer into the payload and what is wrong there. The messages read like the ones the TypeScript check in `gasp-wiki-mcp/src/ossie/check.ts` writes for the same payload, which `validate_mapping` and `compile_model` report.
42
+
43
+ The schema inside the package is a copy of `standard/gasp-ossie-extension-v1.json`, written by `npm run derive` in `gasp-wiki-mcp`; `npm run derive:check` fails when the two differ. `gasp-wiki-mcp/test/ossie-vendor.test.ts` runs every GASP export through the vendored validator with `--vendor GASP` and checks that planted bad payloads are named at their sites.
44
+
45
+ Releases go to [PyPI](https://pypi.org/project/gasp-ossie-validator/) from the workflow `publish-ossie-validator.yml` in GASP-Standard/standard, through trusted publishing, so no token is stored. The workflow builds the package, runs the built wheel over the published GASP files and uploads it. The package sits outside the `gasp-standard-mcp` npm tarball.
46
+
47
+ ## Licence
48
+
49
+ Apache License 2.0, as the rest of `gasp-wiki-mcp`.
@@ -0,0 +1,43 @@
1
+ [project]
2
+ name = "gasp-ossie-validator"
3
+ version = "0.1.0"
4
+ description = "Checks the GASP payloads in an Apache Ossie document against the GASP extension schema, as a vendor validator for validation/validate.py --vendor GASP"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE"]
8
+ authors = [{ name = "Gareth O'Shea" }]
9
+ keywords = ["ossie", "apache-ossie", "semantic-model", "saas-metrics", "gasp", "validation"]
10
+ classifiers = [
11
+ "Development Status :: 4 - Beta",
12
+ "Intended Audience :: Developers",
13
+ "Programming Language :: Python :: 3",
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Topic :: Software Development :: Quality Assurance",
18
+ ]
19
+ requires-python = ">=3.11"
20
+ dependencies = ["jsonschema>=4.26.0"]
21
+
22
+ [project.urls]
23
+ Homepage = "https://gaspwiki.com/downloads/ossie/"
24
+ Repository = "https://github.com/GASP-Standard/standard"
25
+ Schema = "https://gaspwiki.com/schemas/gasp-ossie-extension-v1.json"
26
+
27
+ # The hook in apache/ossie validation/validate.py (#697): the entry point name is
28
+ # the vendor token in extensions/vendors.md, matched exactly.
29
+ [project.entry-points."ossie.vendor_validators"]
30
+ GASP = "gasp_ossie_validator:check"
31
+
32
+ [build-system]
33
+ # 1.27 is the first hatchling that reads the SPDX licence expression and license-files (PEP 639).
34
+ requires = ["hatchling>=1.27"]
35
+ build-backend = "hatchling.build"
36
+
37
+ [tool.hatch.build.targets.wheel]
38
+ packages = ["src/gasp_ossie_validator"]
39
+
40
+ # uv rebuilds a local package only when a cache key changes; the module and the
41
+ # schema copy are part of it, so an edit to either is never served from the cache.
42
+ [tool.uv]
43
+ cache-keys = [{ file = "pyproject.toml" }, { file = "src/**/*" }]
@@ -0,0 +1,104 @@
1
+ """GASP's vendor validator for Apache Ossie documents.
2
+
3
+ `validation/validate.py --vendor GASP` (apache/ossie #697) hands this module the
4
+ `data` object of every `nonportable_extensions` entry whose `vendor_name` is
5
+ `GASP`, with the site it sits on. `check` validates the object against the
6
+ definition the GASP extension schema gives that site: the semantic model, a
7
+ dataset, a metric or the mapping. GASP defines no extension on a field or a
8
+ relationship, so a GASP payload there is reported.
9
+
10
+ The schema beside this file is a copy of `standard/gasp-ossie-extension-v1.json`,
11
+ written by `npm run derive` in `gasp-wiki-mcp`. The messages read like the ones
12
+ `checkExport` in `gasp-wiki-mcp/src/ossie/check.ts` writes for the same payload.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ from functools import cache
19
+ from importlib.resources import files
20
+ from typing import Any
21
+
22
+ from jsonschema import Draft202012Validator
23
+ from jsonschema.exceptions import ValidationError
24
+
25
+ SCHEMA_FILE = "gasp-ossie-extension-v1.json"
26
+
27
+ # Site kind (validate.py's ExtensionSite.kind) to the schema definition for it.
28
+ PLACEMENTS = {
29
+ "model": "ModelExtension",
30
+ "dataset": "DatasetExtension",
31
+ "metric": "MetricExtension",
32
+ "mapping": "MappingExtension",
33
+ }
34
+
35
+
36
+ @cache
37
+ def schema() -> dict[str, Any]:
38
+ """The GASP extension schema this package was built with."""
39
+ return json.loads(files(__package__).joinpath(SCHEMA_FILE).read_text(encoding="utf-8"))
40
+
41
+
42
+ @cache
43
+ def _validator(definition: str) -> Draft202012Validator:
44
+ # One definition as the root, with the shared definitions beside it so the
45
+ # `#/$defs/...` references inside it resolve without the schema's $id.
46
+ return Draft202012Validator({"$ref": f"#/$defs/{definition}", "$defs": schema()["$defs"]})
47
+
48
+
49
+ def _type_names(expected: Any) -> str:
50
+ return ",".join(expected) if isinstance(expected, list) else str(expected)
51
+
52
+
53
+ def _messages(error: ValidationError) -> list[str]:
54
+ """One line per finding: the JSON pointer into the payload, then what is wrong."""
55
+ path = "/" + "/".join(str(part) for part in error.absolute_path)
56
+ keyword, expected = error.validator, error.validator_value
57
+ if keyword == "additionalProperties":
58
+ properties = error.schema.get("properties", {})
59
+ extra = sorted(key for key in error.instance if key not in properties)
60
+ return [f"`{path}` must NOT have additional properties: `{key}`" for key in extra]
61
+ if keyword == "required":
62
+ missing = [key for key in expected if key not in error.instance]
63
+ return [f"`{path}` must have required property '{key}'" for key in missing]
64
+ if keyword == "dependentRequired":
65
+ return [
66
+ f"`{path}` must have {'property' if len(missing) == 1 else 'properties'} {', '.join(missing)} "
67
+ f"when property {key} is present"
68
+ for key, needed in expected.items()
69
+ if key in error.instance and (missing := [k for k in needed if k not in error.instance])
70
+ ]
71
+ if keyword == "type":
72
+ return [f"`{path}` must be {_type_names(expected)}"]
73
+ if keyword == "enum":
74
+ allowed = ", ".join(json.dumps(value) for value in expected)
75
+ return [f"`{path}` must be equal to one of the allowed values: {allowed}"]
76
+ if keyword == "const":
77
+ return [f"`{path}` must be equal to constant {json.dumps(expected)}"]
78
+ if keyword == "pattern":
79
+ return [f'`{path}` must match pattern "{expected}"']
80
+ if keyword in ("minimum", "maximum"):
81
+ return [f"`{path}` must be {'>=' if keyword == 'minimum' else '<='} {expected}"]
82
+ if keyword in ("anyOf", "oneOf"):
83
+ return [f"`{path}` must match a schema in {keyword}"]
84
+ message = error.message
85
+ return [f"`{path}` {message if len(message) <= 200 else message[:197] + '...'}"]
86
+
87
+
88
+ def check(payload: dict[str, Any], site: Any) -> list[str]:
89
+ """The findings on one GASP payload; empty when it matches its site's definition.
90
+
91
+ `site` is validate.py's ExtensionSite: `kind` is one of model, dataset, field,
92
+ metric, relationship or mapping. The caller names the site in front of each
93
+ message, so the messages say only what is wrong inside the payload.
94
+ """
95
+ kind = getattr(site, "kind", None)
96
+ definition = PLACEMENTS.get(kind)
97
+ if definition is None:
98
+ return [
99
+ f"GASP defines no extension on a {kind}; its payloads sit on the semantic model, "
100
+ "a dataset, a metric or the mapping"
101
+ ]
102
+ errors = sorted(_validator(definition).iter_errors(payload), key=lambda e: [str(p) for p in e.absolute_path])
103
+ # jsonschema raises one error per missing key; each lists them all here, so keep the first of each line.
104
+ return list(dict.fromkeys(message for error in errors for message in _messages(error)))
@@ -0,0 +1,245 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://gaspwiki.com/schemas/gasp-ossie-extension-v1.json",
4
+ "title": "GASP Ossie Extension",
5
+ "description": "Describes the GASP payloads in Apache Ossie documents. Every Ossie document GASP writes carries nonportable_extensions entries with vendor_name GASP whose data is an object; this schema describes that object, one definition per placement: the semantic model, a dataset, a metric and the mapping. GASP writes no extension on fields or relationships. Each key here is a gap in the Ossie specification today, so a key retired by an upstream merge leaves this schema. Versioned independently of the Ossie specification.",
6
+ "anyOf": [
7
+ { "$ref": "#/$defs/ModelExtension" },
8
+ { "$ref": "#/$defs/DatasetExtension" },
9
+ { "$ref": "#/$defs/MetricExtension" },
10
+ { "$ref": "#/$defs/MappingExtension" }
11
+ ],
12
+ "$defs": {
13
+ "ModelExtension": {
14
+ "type": "object",
15
+ "description": "On the semantic model document: how the model was made. profile_schema writes profiled; compile_model writes compiled and drops the profiled record it replaces.",
16
+ "properties": {
17
+ "profiled": {
18
+ "type": "object",
19
+ "description": "The model was written by the schema profiler (profile_schema).",
20
+ "required": ["input", "statistics", "questions"],
21
+ "properties": {
22
+ "input": { "enum": ["columns-json", "tables-json", "columns-csv", "ddl"], "description": "The schema format the profiler read: information_schema rows as JSON or CSV, a tables list or CREATE TABLE statements" },
23
+ "statistics": { "type": "boolean", "description": "Whether per-column statistics were given" },
24
+ "questions": { "type": "integer", "minimum": 0, "description": "How many questions the profiler could not settle" }
25
+ },
26
+ "additionalProperties": false
27
+ },
28
+ "compiled": {
29
+ "type": "object",
30
+ "description": "The GASP metrics were compiled into the model (compile_model).",
31
+ "required": ["gasp_version", "dialect", "period_spine", "metrics", "staged"],
32
+ "properties": {
33
+ "gasp_version": { "const": "1", "description": "The GASP extension version" },
34
+ "dialect": { "$ref": "#/$defs/OssieDialect", "description": "The dialect the compiled metrics and staged sources are written in" },
35
+ "period_spine": { "type": "string", "description": "The table of reporting periods the staged datasets read" },
36
+ "metrics": { "type": "integer", "minimum": 0, "description": "How many GASP metrics were compiled in" },
37
+ "staged": { "type": "integer", "minimum": 0, "description": "How many staged datasets were written" }
38
+ },
39
+ "additionalProperties": false
40
+ }
41
+ },
42
+ "additionalProperties": false
43
+ },
44
+ "DatasetExtension": {
45
+ "type": "object",
46
+ "description": "On a dataset. A reference dataset carries kind with cel and activeWhen where the ontology declares them; a staged dataset carries staged, for, reason and source_dialect; the period spine carries period_spine; a profiled dataset carries profile. record_decision adds profile to whatever a dataset already carries.",
47
+ "properties": {
48
+ "kind": { "enum": ["event", "snapshot", "fact"], "description": "The GASP dataset kind (ontology.json datasets)" },
49
+ "cel": { "enum": ["Revenue_Event", "Cost_Event", "Contract_Event", "Amendment_Event", "Lifecycle_State_Change", "Credit_Event"], "description": "The CEL event class the dataset holds" },
50
+ "activeWhen": { "type": "string", "description": "Grammar condition selecting live rows, used for cohort membership" },
51
+ "staged": { "const": true, "description": "The dataset is a staged per-period dataset holding one metric's value" },
52
+ "for": { "type": "string", "description": "The metric the staged dataset holds" },
53
+ "reason": { "$ref": "#/$defs/StagedReason" },
54
+ "source_dialect": { "$ref": "#/$defs/OssieDialect", "description": "The dialect the dataset's source query is written in (Ossie's source has no dialect property)" },
55
+ "sources": {
56
+ "type": "object",
57
+ "description": "The source query in each other dialect",
58
+ "propertyNames": { "$ref": "#/$defs/OssieDialect" },
59
+ "additionalProperties": { "type": "string" }
60
+ },
61
+ "period_spine": { "const": true, "description": "The dataset is the table of reporting periods the staged datasets read" },
62
+ "profile": { "$ref": "#/$defs/DatasetProfile" }
63
+ },
64
+ "dependentRequired": {
65
+ "staged": ["for", "reason", "source_dialect"],
66
+ "for": ["staged"],
67
+ "reason": ["staged"],
68
+ "source_dialect": ["staged"],
69
+ "sources": ["staged"],
70
+ "cel": ["kind"],
71
+ "activeWhen": ["kind"]
72
+ },
73
+ "additionalProperties": false
74
+ },
75
+ "MetricExtension": {
76
+ "type": "object",
77
+ "description": "On a metric GASP compiled: the canonical metric it implements.",
78
+ "required": ["gasp_id", "gasp_version", "unit", "formula"],
79
+ "properties": {
80
+ "gasp_id": { "type": "string", "description": "The GASP formula id (formulas.json)" },
81
+ "gasp_version": { "const": "1", "description": "The GASP extension version" },
82
+ "form": { "enum": ["O", "M"], "description": "The dual-lens form: Operating or Market" },
83
+ "variant": { "type": "string", "description": "The named variant of the formula" },
84
+ "unit": { "enum": ["currency", "percent", "ratio", "count", "days", "months", "hours", "minutes", "milliseconds", "score"], "description": "The unit of the value; ratios are unscaled" },
85
+ "formula": { "type": "string", "description": "The canonical formula in the GASP grammar" },
86
+ "gasp_breakdown": { "type": "string", "description": "The breakdown dimension, as a field or dataset.field" },
87
+ "staged": { "const": true, "description": "The metric reads a staged dataset" }
88
+ },
89
+ "additionalProperties": false
90
+ },
91
+ "MappingExtension": {
92
+ "type": "object",
93
+ "description": "On the mapping document. A mapping converted from a v1 adapter carries the adapter's metadata; propose_mapping writes organization and proposed; record_decision keeps what is there and adds metricOwners and decisions.",
94
+ "properties": {
95
+ "adapter_version": { "type": "string", "description": "The version of the v1 adapter the mapping was converted from" },
96
+ "organization": { "type": "string", "description": "The organization the mapping describes" },
97
+ "warehouse": { "type": "string", "description": "The warehouse platform" },
98
+ "metricOwners": {
99
+ "type": "array",
100
+ "description": "Who owns each metric definition, as in the adapter schema",
101
+ "items": { "$ref": "#/$defs/MetricOwner" }
102
+ },
103
+ "proposed": {
104
+ "type": "object",
105
+ "description": "What the mapping proposer paired and what it left to review",
106
+ "required": ["datasets", "fields", "transforms", "candidates", "unmatched"],
107
+ "properties": {
108
+ "datasets": { "type": "integer", "minimum": 0, "description": "Tables proposed to a GASP dataset" },
109
+ "fields": { "type": "integer", "minimum": 0, "description": "Field pairs in the mapping" },
110
+ "transforms": { "type": "integer", "minimum": 0, "description": "Field pairs read through a transform" },
111
+ "candidates": { "type": "array", "items": { "$ref": "#/$defs/Candidate" } },
112
+ "unmatched": { "type": "array", "items": { "$ref": "#/$defs/UnmatchedTable" } }
113
+ },
114
+ "additionalProperties": false
115
+ },
116
+ "decisions": {
117
+ "type": "array",
118
+ "description": "Every decision on file, one per subject",
119
+ "items": { "$ref": "#/$defs/DecisionRecord" }
120
+ }
121
+ },
122
+ "additionalProperties": false
123
+ },
124
+ "OssieDialect": {
125
+ "enum": ["POSTGRES", "SNOWFLAKE", "BIGQUERY", "DATABRICKS"],
126
+ "description": "A registered Ossie dialect GASP compiles to"
127
+ },
128
+ "StagedReason": {
129
+ "enum": ["cohort", "lag", "window", "all_time", "distinct pair", "bucket", "total", "to_date", "at period_start", "period bound in filter", "period bound", "period_days"],
130
+ "description": "The construct the Ossie expression language cannot state, so the metric is staged"
131
+ },
132
+ "Confidence": { "enum": ["declared", "high", "medium", "low"] },
133
+ "DatasetProfile": {
134
+ "type": "object",
135
+ "description": "What the profiler inferred about the table, with confidence and evidence; record_decision marks a decided key, time field or kind declared",
136
+ "properties": {
137
+ "kind": { "enum": ["snapshot", "event", "fact", "reference"], "description": "The inferred or decided table kind" },
138
+ "confidence": {
139
+ "type": "object",
140
+ "properties": {
141
+ "kind": { "$ref": "#/$defs/Confidence" },
142
+ "key": { "$ref": "#/$defs/Confidence" },
143
+ "time": { "$ref": "#/$defs/Confidence" }
144
+ },
145
+ "additionalProperties": false
146
+ },
147
+ "evidence": {
148
+ "type": "object",
149
+ "properties": {
150
+ "kind": { "type": "string" },
151
+ "key": { "type": "string" },
152
+ "time": { "type": "string" }
153
+ },
154
+ "additionalProperties": false
155
+ },
156
+ "questions": { "type": "array", "items": { "$ref": "#/$defs/Question" } },
157
+ "values": {
158
+ "type": "object",
159
+ "description": "Column → the enum values listed for it",
160
+ "additionalProperties": { "type": "array", "items": { "type": "string" } }
161
+ }
162
+ },
163
+ "additionalProperties": false
164
+ },
165
+ "Question": {
166
+ "type": "object",
167
+ "description": "What the profiler could not settle from the names and statistics",
168
+ "required": ["dataset", "about", "question", "why"],
169
+ "properties": {
170
+ "dataset": { "type": "string" },
171
+ "about": { "enum": ["key", "time", "type"] },
172
+ "question": { "type": "string" },
173
+ "options": { "type": "array", "items": { "type": "string" } },
174
+ "why": { "type": "string" }
175
+ },
176
+ "additionalProperties": false
177
+ },
178
+ "MetricOwner": {
179
+ "type": "object",
180
+ "required": ["metric", "team"],
181
+ "properties": {
182
+ "metric": { "type": "string" },
183
+ "team": { "type": "string" },
184
+ "contact": { "type": "string" }
185
+ },
186
+ "additionalProperties": false
187
+ },
188
+ "Candidate": {
189
+ "type": "object",
190
+ "description": "A table or column pair the evidence supports without settling",
191
+ "required": ["table", "source", "dataset", "evidence", "settle"],
192
+ "properties": {
193
+ "table": { "type": "string" },
194
+ "source": { "type": "string" },
195
+ "column": { "type": "string" },
196
+ "dataset": { "type": "string" },
197
+ "field": { "type": "string" },
198
+ "evidence": { "type": "string" },
199
+ "settle": { "type": "string" }
200
+ },
201
+ "additionalProperties": false
202
+ },
203
+ "UnmatchedTable": {
204
+ "type": "object",
205
+ "description": "A table no GASP dataset matches, with the nearest one",
206
+ "required": ["table", "source"],
207
+ "properties": {
208
+ "table": { "type": "string" },
209
+ "source": { "type": "string" },
210
+ "best": {
211
+ "type": "object",
212
+ "required": ["dataset", "score"],
213
+ "properties": {
214
+ "dataset": { "type": "string" },
215
+ "score": { "type": "number" }
216
+ },
217
+ "additionalProperties": false
218
+ }
219
+ },
220
+ "additionalProperties": false
221
+ },
222
+ "DecisionRecord": {
223
+ "type": "object",
224
+ "description": "A decision as recorded: who decided what, when, and what applying it did",
225
+ "required": ["about", "owner", "date", "effect"],
226
+ "properties": {
227
+ "about": { "enum": ["key", "time", "kind", "type", "table", "field", "owner", "topic"] },
228
+ "dataset": { "type": "string" },
229
+ "column": { "type": "string" },
230
+ "to": { "type": "string" },
231
+ "answer": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] },
232
+ "accept": { "type": "boolean" },
233
+ "transform": { "type": "string" },
234
+ "metric": { "type": "string" },
235
+ "contact": { "type": "string" },
236
+ "topic": { "type": "string" },
237
+ "owner": { "type": "string" },
238
+ "date": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
239
+ "note": { "type": "string" },
240
+ "effect": { "type": "string" }
241
+ },
242
+ "additionalProperties": false
243
+ }
244
+ }
245
+ }