Skip to content

Formally define traits in swagger parser #346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions kernel_gateway/notebook_http/cell/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import re
import sys
from traitlets import Unicode
from traitlets.config.configurable import LoggingConfigurable

def first_path_param_index(endpoint):
Expand Down Expand Up @@ -63,8 +64,8 @@ class APICellParser(LoggingConfigurable):
api_response_indicator : str
Regex pattern for API response metadata annotations
"""
api_indicator = r'{}\s+(GET|PUT|POST|DELETE)\s+(\/.*)+'
api_response_indicator = r'{}\s+ResponseInfo\s+(GET|PUT|POST|DELETE)\s+(\/.*)+'
api_indicator = Unicode(default_value=r'{}\s+(GET|PUT|POST|DELETE)\s+(\/.*)+')
api_response_indicator = Unicode(default_value=r'{}\s+ResponseInfo\s+(GET|PUT|POST|DELETE)\s+(\/.*)+')

def __init__(self, comment_prefix, *args, **kwargs):
super(APICellParser, self).__init__(*args, **kwargs)
Expand Down
8 changes: 4 additions & 4 deletions kernel_gateway/notebook_http/swagger/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import json
import re
from kernel_gateway.notebook_http.cell.parser import first_path_param_index, APICellParser
from traitlets import default
from traitlets import List, Unicode
from traitlets.config.configurable import LoggingConfigurable

def _swaggerlet_from_markdown(cell_source):
Expand Down Expand Up @@ -62,9 +62,9 @@ class SwaggerCellParser(LoggingConfigurable):
operation_response_indicator : str
Regex pattern for API response metadata annotations
"""
operation_indicator = r'{}\s*operationId:\s*(.*)'
operation_response_indicator = r'{}\s*ResponseInfo\s+operationId:\s*(.*)'
notebook_cells = []
operation_indicator = Unicode(default_value=r'{}\s*operationId:\s*(.*)')
operation_response_indicator = Unicode(default_value=r'{}\s*ResponseInfo\s+operationId:\s*(.*)')
notebook_cells = List()

def __init__(self, comment_prefix, *args, **kwargs):
super(SwaggerCellParser, self).__init__(*args, **kwargs)
Expand Down