Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions tests/schema/__snapshots__/test_schema.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -3449,6 +3449,96 @@
}),
})
# ---
# name: test_schemas[schema/fixtures/fields-docname_select_error]
'''
ERROR: Need 'IMPL_1' has schema violations:
Severity: violation
Need path: IMPL_1
Schema path: [0] > local > required
User message: asil required for needs in index file
Schema message: "asil" is a required property [sn_schema_violation.local_fail]

'''
# ---
# name: test_schemas[schema/fixtures/fields-docname_select_error].1
dict({
'validated_needs_count': 1,
'validation_warnings': dict({
'IMPL_1': list([
dict({
'children': list([
]),
'details': dict({
'need_path': 'IMPL_1',
'schema_path': '[0] > local > required',
'severity': 'violation',
'user_msg': 'asil required for needs in index file',
'validation_msg': '"asil" is a required property',
}),
'log_lvl': 'error',
'subtype': 'local_fail',
'type': 'sn_schema_violation',
}),
]),
}),
})
# ---
# name: test_schemas[schema/fixtures/fields-docname_select_success]
''
# ---
# name: test_schemas[schema/fixtures/fields-docname_select_success].1
dict({
'validated_needs_count': 1,
'validation_warnings': dict({
}),
})
# ---
# name: test_schemas[schema/fixtures/fields-docname_validate_error]
'''
ERROR: Need 'IMPL_1' has schema violations:
Severity: violation
Field: docname
Need path: IMPL_1
Schema path: [0] > local > properties > docname > pattern
User message: all needs must be in other file
Schema message: "index" does not match "other" [sn_schema_violation.local_fail]

'''
# ---
# name: test_schemas[schema/fixtures/fields-docname_validate_error].1
dict({
'validated_needs_count': 1,
'validation_warnings': dict({
'IMPL_1': list([
dict({
'children': list([
]),
'details': dict({
'field': 'docname',
'need_path': 'IMPL_1',
'schema_path': '[0] > local > properties > docname > pattern',
'severity': 'violation',
'user_msg': 'all needs must be in other file',
'validation_msg': '"index" does not match "other"',
}),
'log_lvl': 'error',
'subtype': 'local_fail',
'type': 'sn_schema_violation',
}),
]),
}),
})
# ---
# name: test_schemas[schema/fixtures/fields-docname_validate_success]
''
# ---
# name: test_schemas[schema/fixtures/fields-docname_validate_success].1
dict({
'validated_needs_count': 1,
'validation_warnings': dict({
}),
})
# ---
# name: test_schemas[schema/fixtures/fields-enum]
''
# ---
Expand Down
90 changes: 90 additions & 0 deletions tests/schema/fixtures/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -794,3 +794,93 @@ multiple_errors_per_need:
:id: IMPL_1
:priority: 8
:severity: critical

docname_select_error:
conf: |
extensions = ["sphinx_needs"]
needs_from_toml = "ubproject.toml"
needs_schema_definitions_from_json = "schemas.json"
ubproject: |
[needs.fields.asil]
nullable = true
rst: |
.. impl:: title
:id: IMPL_1
schemas:
$defs: []
schemas:
- message: asil required for needs in index file
select:
properties:
docname:
pattern: "index"
required: ["docname"]
validate:
local:
required: ["asil"]

docname_select_success:
conf: |
extensions = ["sphinx_needs"]
needs_from_toml = "ubproject.toml"
needs_schema_definitions_from_json = "schemas.json"
ubproject: |
[needs.fields.asil]
nullable = true
rst: |
.. impl:: title
:id: IMPL_1
schemas:
$defs: []
schemas:
- message: asil required for needs in other file
select:
properties:
docname:
pattern: "other"
required: ["docname"]
validate:
local:
required: ["asil"]

docname_validate_error:
conf: |
extensions = ["sphinx_needs"]
needs_from_toml = "ubproject.toml"
needs_schema_definitions_from_json = "schemas.json"
ubproject: |
[needs.fields.asil]
nullable = true
rst: |
.. impl:: title
:id: IMPL_1
schemas:
$defs: []
schemas:
- message: all needs must be in other file
validate:
local:
properties:
docname:
pattern: "other"

docname_validate_success:
conf: |
extensions = ["sphinx_needs"]
needs_from_toml = "ubproject.toml"
needs_schema_definitions_from_json = "schemas.json"
ubproject: |
[needs.fields.asil]
nullable = true
rst: |
.. impl:: title
:id: IMPL_1
schemas:
$defs: []
schemas:
- message: all needs must be in index file
validate:
local:
properties:
docname:
pattern: "index"