diff --git a/examples/roles/hello/meta/main.yml b/examples/roles/hello/meta/main.yml index b15a998b76..1ef461e6da 100644 --- a/examples/roles/hello/meta/main.yml +++ b/examples/roles/hello/meta/main.yml @@ -1,3 +1,10 @@ --- dependencies: - role: bobbins + +argument_specs: + main: + short_description: "The main entry point" + options: + example_var: + type: str diff --git a/examples/roles/invalid_meta_specs/meta/main.yml b/examples/roles/invalid_meta_specs/meta/main.yml new file mode 100644 index 0000000000..ae5b10ac89 --- /dev/null +++ b/examples/roles/invalid_meta_specs/meta/main.yml @@ -0,0 +1,12 @@ +--- +galaxy_info: + author: "ansible-lint" + description: "test" + license: "MIT" + min_ansible_version: "2.10" + +argument_specs: + main: + options: + my_var: + type: not_a_real_type diff --git a/src/ansiblelint/schemas/meta.json b/src/ansiblelint/schemas/meta.json index 619ac1b6cd..bbdbe9a0e0 100644 --- a/src/ansiblelint/schemas/meta.json +++ b/src/ansiblelint/schemas/meta.json @@ -1570,6 +1570,13 @@ }, "galaxy_info": { "$ref": "#/$defs/GalaxyInfoModel" + }, + "argument_specs": { + "title": "Role Argument Specifications", + "type": "object", + "additionalProperties": { + "$ref": "role-arg-spec.json#/$defs/entry_point" + } } }, "title": "Ansible Meta Schema v1/v2", diff --git a/test/schemas/src/schema.spec.ts b/test/schemas/src/schema.spec.ts index 9341622ffd..182657f734 100644 --- a/test/schemas/src/schema.spec.ts +++ b/test/schemas/src/schema.spec.ts @@ -46,6 +46,11 @@ const schema_files = fs .filter((el) => path.extname(el) === ".json"); console.log(`Schemas: ${schema_files}`); +schema_files.forEach((schema_file) => { + const schema_json = JSON.parse(fs.readFileSync(`f/${schema_file}`, "utf8")); + ajv.addSchema(schema_json, schema_file); +}); + describe("schemas under f/", () => { schema_files.forEach((schema_file) => { if ( @@ -54,8 +59,11 @@ describe("schemas under f/", () => { ) { return; } - const schema_json = JSON.parse(fs.readFileSync(`f/${schema_file}`, "utf8")); - ajv.addSchema(schema_json); + const schema_instance = ajv.getSchema(schema_file); + if (!schema_instance) return; + + // biome-ignore lint/suspicious/noExplicitAny: internal test suite needs to access dynamic schema properties + const schema_json = schema_instance.schema as any; const validator = ajv.compile(schema_json); if ( schema_json.examples === undefined &&