Commit 04bcdcde authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

formatting

parent 484295a3
...@@ -13,12 +13,15 @@ import jsonschema ...@@ -13,12 +13,15 @@ import jsonschema
import requests import requests
import validata_core import validata_core
from commonmark import commonmark from commonmark import commonmark
from flask import (abort, make_response, redirect, render_template, request, from flask import abort, make_response, redirect, render_template, request, url_for
url_for)
from opendataschema import GitSchemaReference, by_commit_date from opendataschema import GitSchemaReference, by_commit_date
from validata_core.helpers import (FileContentValidataResource, from validata_core.helpers import (
URLValidataResource, ValidataResource, FileContentValidataResource,
is_body_error, is_structure_error) URLValidataResource,
ValidataResource,
is_body_error,
is_structure_error,
)
from . import app, config, fetch_schema, pdf_service, schema_catalog_registry from . import app, config, fetch_schema, pdf_service, schema_catalog_registry
from .model import Section from .model import Section
...@@ -134,10 +137,14 @@ class SchemaInstance: ...@@ -134,10 +137,14 @@ class SchemaInstance:
def request_parameters(self): def request_parameters(self):
"""Build request parameter dict to identify schema.""" """Build request parameter dict to identify schema."""
return { return (
"schema_name": self.schema_and_section_name, {
"schema_ref": "" if self.ref is None else self.ref, "schema_name": self.schema_and_section_name,
} if self.name else {"schema_url": self.url} "schema_ref": "" if self.ref is None else self.ref,
}
if self.name
else {"schema_url": self.url}
)
def find_section_title(self, section_name): def find_section_title(self, section_name):
"""Return section title or None if not found.""" """Return section title or None if not found."""
...@@ -344,6 +351,7 @@ def get_badge_url_and_message(badge): ...@@ -344,6 +351,7 @@ def get_badge_url_and_message(badge):
def validate(schema_instance: SchemaInstance, validata_resource: ValidataResource): def validate(schema_instance: SchemaInstance, validata_resource: ValidataResource):
"""Validate source and display report.""" """Validate source and display report."""
def compute_resource_info(resource: ValidataResource): def compute_resource_info(resource: ValidataResource):
source = resource.get_source() source = resource.get_source()
return { return {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment