Giter Site home page Giter Site logo

paulgirard / linked-art-json-validator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from linked-art/json-validator

0.0 1.0 0.0 246 KB

json-schema validation of linked.art resources

License: Apache License 2.0

JavaScript 0.08% Python 0.08% CSS 0.43% HTML 99.41%

linked-art-json-validator's Introduction

json-validator

json-schema validation of linked.art resources

Validation

schema-test.py shows how to validate records:

In particular:

# load the appropriate schema json into schema here
v = Draft7Validator(schema)
# load the appropriate instance json into data here
errs = []
for error in v.iter_errors(data):
	errs.append(error)
	print(f"  /{'/'.join([str(x) for x in error.absolute_path])} --> {error.message} ")
if not errs:
	print("Validated!")

Output from the script is, for example:

------------------------------------------------------------------------------------------------------------------------
Processing: ../linked.art/content/example/person/12.json
  /member_of/0 --> 'id' is a required property 
  /member_of/0 --> Additional properties are not allowed ('member_of', 'classified_as' were unexpected) 
------------------------------------------------------------------------------------------------------------------------
Processing: ../linked.art/content/example/person/13.json
  Validated!

Documentation Generator

Install the generator:

pip install json-schema-for-humans

Run the generator:

generate-schema-doc --config no_show_breadcrumbs --config description_is_markdown --config template_folder=$PWD/template --config template_name=la schema/object.json html/object.html

The options I use:

  • no_show_breadcrumbs: this prevents it from showing the path through the schema at each stage. We don't care about the structure of the schema in the API docs.
  • description_is_markdown: parses the description field in the schemas as markdown not plain text, allowing links and basic formatting
  • template_folder is where templates are available
  • template_name is the name of the template within the above folder (another directory, with the HTML, CSS and JS files in it)

linked-art-json-validator's People

Contributors

azaroth42 avatar paulgirard avatar yulgit1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.