-
-
Notifications
You must be signed in to change notification settings - Fork 199
Open
Description
- Tavern version: 2.16.0
- Python version: 3.10.0
- pytest version: 7.2.2
- OS: Linux
I'm encountering a BadSchemaError when trying to run a Tavern test that includes stages via !include and attempts to save response data. The error message indicates:
Additional properties are not allowed ('save' was unexpected)
test_name: Test GET /knowledge-bases/{knowledge_base_id}/content/overview
stages:
- !include ../../stages/login_stage.yaml
- !include ../../stages/create_knowledge_base_stage.yaml
- name: Get Knowledge Base Content Overview
request:
url: "{host}/api/v1/knowledge-bases/{knowledge_base_id}/content/overview"
method: GET
headers:
Authorization: "Bearer {access_token}"
response:
status_code: 200
headers:
content-type: application/json
json:
files: !anything
total_files: !anything
save:
json:
content_overview: "$"
stages/create_knowledge_base_stage.yaml:
name: create_knowledge_base
request:
url: "{host}/api/v1/knowledge-bases"
method: POST
headers:
Authorization: "Bearer {access_token}"
Content-Type: "application/json"
json:
name: "Test KB {random_string}"
description: "A test knowledge base created by Tavern tests"
response:
status_code: 201
headers:
content-type: application/json
json:
id: !re_match "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
name: !re_match "Test KB .*"
description: "A test knowledge base created by Tavern tests"
created_at: !re_match ".*T.*Z"
updated_at: !re_match ".*T.*Z"
is_deleted: false
preprocessing_method_id: !anything
ingestion_method_id: !anything
digestion_method_id: !anything
save:
json:
knowledge_base_id: id
Error Details
The error occurs during schema validation, specifically:
tavern._core.exceptions.BadSchemaError:
---
Additional properties are not allowed ('save' was unexpected)
/tests/knowledge-bases/test_get_knowledge_base_content_overview.tavern.yaml: line 2-21:
What I've Tried
- Initially had a
variablessection at the test level, removed it - Ensured consistent YAML indentation
- Removed any deprecated keys like
verify_response_with - Confirmed included stage files are valid Tavern stages
- Reduced the test to minimal components
Questions:
- Is
savenot allowed in test stages when using!include? The documentation suggestssaveshould be valid at the stage level. - Should
savebe placed differently when stages are included via!include? - Is there a known issue with schema validation when combining
!includewithsavedirectives? - What's the correct way to save response data from a stage that's defined inline (not via
!include)?
Metadata
Metadata
Assignees
Labels
No labels