Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan-wanna-M committed Oct 27, 2024
1 parent 9e70131 commit a01d5ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/formatron/formats/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ def __init__(self, nonterminal: str, capture_name: typing.Optional[str], schema:
- pattern currently is automatically anchored at both ends
- the generated json could be invalid if the pattern allows invalid content between the json string's quotes.
- for example, `pattern=".*"` will allow '\"' to appear in the json string which is forbidden by JSON standard.
- also supports substring_of constraint which constrains the string to be a substring of a given string
- the generated json could be invalid if the given string contains invalid content when put into the json string's quotes.
- for example, `substring_of="abc\""` will allow '\"' to appear in the json string which is forbidden by JSON standard.
- NoneType
- typing.Any
- Subclasses of collections.abc.Mapping[str,T] and typing.Mapping[str,T] where T is a supported type,
Expand Down
1 change: 1 addition & 0 deletions src/formatron/schemas/json_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def create_schema(schema: dict[str, typing.Any], registry=Registry()) -> schemas
- `type` keyword
- `minLength, maxLength, pattern` keywords for string type
- `substringOf` keyword for string type
- `minimum, maximum, exclusiveMinimum, exclusiveMaximum` keywords for number type and integer type
- `items` keyword
- optionally with `minItems`, `maxItems`, `prefixItems` constraints
Expand Down

0 comments on commit a01d5ba

Please sign in to comment.