Skip to content

Commit

Permalink
schema-markdown 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
craigahobbs committed Aug 23, 2022
1 parent 4b20291 commit 613adf1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def main():
package_dir={'': 'src'},
packages=['chisel'],
install_requires=[
'schema-markdown >= 1.1.12'
'schema-markdown >= 1.2.0'
]
)

Expand Down
6 changes: 3 additions & 3 deletions src/chisel/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from http import HTTPStatus
from json import loads as json_loads

from schema_markdown import SchemaMarkdownParser, ValidationError, decode_query_string, get_referenced_types, validate_type
from schema_markdown import ValidationError, decode_query_string, get_referenced_types, parse_schema_markdown, validate_type

from .app import Context
from .request import Request
Expand Down Expand Up @@ -133,7 +133,7 @@ class Action(Request):
:param list(tuple) urls: The list of URL method/path tuples. The first value is the HTTP request method (e.g. 'GET')
or None to match any. The second value is the URL path or None to use the default path.
:param dict types: Optional dictionary of user type models
:param str spec: Optional action :ref:`schema-markdown:Schema Markdown` specification.
:param str spec: Optional action `Schema Markdown <https://craigahobbs.github.io/schema-markdown-js/language/>`__ specification.
If a specification isn't provided it can be provided through the "types" argument.
:param bool wsgi_response: If True, the callback function's response is a WSGI application function
response. Default is False.
Expand All @@ -152,7 +152,7 @@ def __init__(self, action_callback, name=None, urls=(('POST', None),), types=Non
if types is None:
types = {}
if spec is not None:
SchemaMarkdownParser(spec, types=types)
parse_schema_markdown(spec, types=types)

# Assert that the action model exists
model_type = types.get(name)
Expand Down
10 changes: 5 additions & 5 deletions src/tests/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from io import StringIO
from unittest import TestCase

from schema_markdown import SchemaMarkdownParser, SchemaMarkdownParserError
from schema_markdown import SchemaMarkdownParserError, parse_schema_markdown

from chisel import action, Action, ActionError, Application, Request

Expand Down Expand Up @@ -66,10 +66,10 @@ def my_action(unused_app, unused_req):
# Action decorator with spec parser
def test_decorator_types(self):

spec_parser = SchemaMarkdownParser('''\
types = parse_schema_markdown('''\
action my_action
''')
@action(types=spec_parser.types)
@action(types=types)
def my_action(unused_app, unused_req):
pass # pragma: no cover

Expand All @@ -87,10 +87,10 @@ def my_action(unused_app, unused_req):
# Action decorator with spec parser and a spec
def test_decorator_types_and_spec(self):

spec_parser = SchemaMarkdownParser('''\
types = parse_schema_markdown('''\
typedef int(> 0) PositiveInteger
''')
@action(types=spec_parser.types, spec='''\
@action(types=types, spec='''\
action my_action
input
PositiveInteger value
Expand Down

0 comments on commit 613adf1

Please sign in to comment.