Example #1
0
def doc_view(request, raml_file):
    return HttpResponse(
        get_template('index.html').render(
            Context({
                'api': parse_raml(ramlfications.load(get_raml(raml_file))),
                'pygments_style': formatter.get_style_defs('.source'),
            })))
Example #2
0
 def run(self):
     node = raml()
     node.document = self.state.document
     basepath  = os.path.dirname(self.state.document.current_source)
     parsed = ramlfications.load(os.path.join(basepath, self.arguments[0]))
     node['expr'] = parsed
     self.state.nested_parse(self.content, self.content_offset,
                             node, match_titles=1)
     return [node]
Example #3
0
 def __init__(self):
     # waiting for raml1.0 support in ramlfications
     # we cannot use its raml parser
     # so we just use its loader
     self.api = ramlfications.load(os.path.join(
         os.path.dirname(__file__), os.pardir, 'spec', 'api.raml'))
     endpoints = {}
     self.endpoints_by_type = {}
     self.endpoints = self.parse_endpoints(endpoints, "", self.api)
     self.types = self.parse_types()
Example #4
0
 def __init__(self):
     # waiting for raml1.0 support in ramlfications
     # we cannot use its raml parser
     # so we just use its loader
     self.api = ramlfications.load(
         os.path.join(os.path.dirname(__file__), os.pardir, 'spec',
                      'api.raml'))
     endpoints = {}
     self.endpoints_by_type = {}
     self.endpoints = self.parse_endpoints(endpoints, "", self.api)
     self.types = self.parse_types()
Example #5
0
 def run(self):
     node = raml()
     node.document = self.state.document
     basepath = os.path.dirname(self.state.document.current_source)
     parsed = ramlfications.load(os.path.join(basepath, self.arguments[0]))
     node['expr'] = parsed
     self.state.nested_parse(self.content,
                             self.content_offset,
                             node,
                             match_titles=1)
     return [node]
Example #6
0
    def __init__(self):
        # waiting for raml1.0 support in ramlfications
        # we cannot use its raml parser
        # so we just use its loader
        fn = os.path.join(os.path.dirname(__file__), os.pardir, "spec", "api.raml")
        self.api = ramlfications.load(fn)
        with open(fn) as f:
            self.rawraml = f.read()

        endpoints = {}
        self.endpoints_by_type = {}
        self.rawendpoints = {}
        self.endpoints = self.parse_endpoints(endpoints, "", self.api)
        self.types = self.parse_types()
Example #7
0
def test_load(raml):
    result = load(raml)
    assert result
    assert isinstance(result, dict)