Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
artsmolin committed Dec 18, 2023
1 parent bbedf9b commit 71bcc2b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 234 deletions.
210 changes: 0 additions & 210 deletions docs/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/__config.yml

This file was deleted.

20 changes: 0 additions & 20 deletions docs/features/discriminator.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,2 @@
# Discriminator
Generate [pydantic classes with discriminators](https://docs.pydantic.dev/latest/api/standard_library_types/#discriminated-unions-aka-tagged-unions) based on [OpenAPI discriminators](https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/). The original OpenAPI specification must have the propertyName and mapping fields.

### Property safety name
You can explicitly specify the name with which the property will be generated for the data schema. To do this, specify the desired name in the property description in the format `__safety_key__(your_name)`.

For example, for the original schema with not safety property `event-data`
```yaml
PostObjectData:
title: PostObjectData
type: object
properties:
event-data:
title: Event-Data
type: object
description: __safety_key__(custom_name)
```
the following class with property `custom_name` will be generated
```python
class PostObjectData(BaseModel):
custom_name: dict = Field(..., alias="event-data", description="__safety_key__(custom_name)")
```
19 changes: 19 additions & 0 deletions docs/features/property_safety_name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Property safety name
You can explicitly specify the name with which the property will be generated for the data schema. To do this, specify the desired name in the property description in the format `__safety_key__(your_name)`.

For example, for the original schema with not safety property `event-data`
```yaml
PostObjectData:
title: PostObjectData
type: object
properties:
event-data:
title: Event-Data
type: object
description: __safety_key__(custom_name)
```
the following class with property `custom_name` will be generated
```python
class PostObjectData(BaseModel):
custom_name: dict = Field(..., alias="event-data", description="__safety_key__(custom_name)")
```

0 comments on commit 71bcc2b

Please sign in to comment.