-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from eadwinCode/extra_config_parameter
fix:Extra config dict parameter for new schema generation
- Loading branch information
Showing
3 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import pytest | ||
|
||
from ninja_schema.orm.factory import SchemaFactory | ||
from ninja_schema.pydanticutils import IS_PYDANTIC_V1 | ||
from tests.models import Event | ||
|
||
|
||
@pytest.mark.skipif(IS_PYDANTIC_V1, reason="requires pydantic == 2.1.x") | ||
def test_create_schema_with_model_config_options(): | ||
schema = SchemaFactory.create_schema( | ||
Event, | ||
skip_registry=True, | ||
from_attributes=True, # model_config_option | ||
title="Custom Title", # model_config_option | ||
) | ||
|
||
assert schema.model_config["from_attributes"] is True | ||
assert schema.model_config["title"] == "Custom Title" |