Skip to content

Commit effc677

Browse files
Jkhall81ssbarnea
andauthored
fix: add argument_specs to meta schema (#4762) (#4880)
Co-authored-by: Sorin Sbarnea <[email protected]>
1 parent 9f63dd1 commit effc677

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

examples/roles/hello/meta/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
---
22
dependencies:
33
- role: bobbins
4+
5+
argument_specs:
6+
main:
7+
short_description: "The main entry point"
8+
options:
9+
example_var:
10+
type: str
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
galaxy_info:
3+
author: "ansible-lint"
4+
description: "test"
5+
license: "MIT"
6+
min_ansible_version: "2.10"
7+
8+
argument_specs:
9+
main:
10+
options:
11+
my_var:
12+
type: not_a_real_type

src/ansiblelint/schemas/meta.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,13 @@
15701570
},
15711571
"galaxy_info": {
15721572
"$ref": "#/$defs/GalaxyInfoModel"
1573+
},
1574+
"argument_specs": {
1575+
"title": "Role Argument Specifications",
1576+
"type": "object",
1577+
"additionalProperties": {
1578+
"$ref": "role-arg-spec.json#/$defs/entry_point"
1579+
}
15731580
}
15741581
},
15751582
"title": "Ansible Meta Schema v1/v2",

test/schemas/src/schema.spec.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ const schema_files = fs
4646
.filter((el) => path.extname(el) === ".json");
4747
console.log(`Schemas: ${schema_files}`);
4848

49+
schema_files.forEach((schema_file) => {
50+
const schema_json = JSON.parse(fs.readFileSync(`f/${schema_file}`, "utf8"));
51+
ajv.addSchema(schema_json, schema_file);
52+
});
53+
4954
describe("schemas under f/", () => {
5055
schema_files.forEach((schema_file) => {
5156
if (
@@ -54,8 +59,11 @@ describe("schemas under f/", () => {
5459
) {
5560
return;
5661
}
57-
const schema_json = JSON.parse(fs.readFileSync(`f/${schema_file}`, "utf8"));
58-
ajv.addSchema(schema_json);
62+
const schema_instance = ajv.getSchema(schema_file);
63+
if (!schema_instance) return;
64+
65+
// biome-ignore lint/suspicious/noExplicitAny: internal test suite needs to access dynamic schema properties
66+
const schema_json = schema_instance.schema as any;
5967
const validator = ajv.compile(schema_json);
6068
if (
6169
schema_json.examples === undefined &&

0 commit comments

Comments
 (0)