Skip to content

Example implementation module which support json schema

License

Notifications You must be signed in to change notification settings

Krokop/json_schema_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base module for integration Schema

Install dependency

make build_env

Set couchdb_url in app/main.py

COUCHDB_URL = 'http://admin:admin@127.0.0.1:9000/'

Start server

 make run

Example data

Створемо item з кодом 0412234 та версією 1 POST on 127.0.0.1:5000/items/

{
  "data": {
    "name": "First item",
    "cpv": "0412234",
    "properties": {
      "version": "1",
      "props": {
        "number_of_kitchen": 1,
        "total_area": 30,
        "number_of_rooms": 6,
        "living_space": 2
      }
    }
  }
}

Переглянемо створений item GET on 127.0.0.1:5000/items/{id_item}/

{
  "_rev": "1-7dafbb12197edb81d5aa037fb49c0a2d",
  "doc_type": "Item",
  "_id": "{id_item}",
  "cpv": "0412234",
  "name": "First item",
  "properties": {
    "props": {
      "total_area": 30,
      "number_of_rooms": 6,
      "living_space": 2,
      "number_of_kitchen": 1
    },
    "save_cpv": "04122",
    "doc_type": "BaseSchema",
    "version": "001"
  }
}

Але версія 1 нам не підходить і ми хочемо оновитися до 2, для цоього зробимо PATCH з новою версією та даними.

{
  "data": {
    "properties": {
      "version": 2,
      "props": {
        "number_of_doors": 5,
        "number_of_kitchen": 1,
        "total_area": 2,
        "number_of_rooms": 5
      }
    }
  }
}

About

Example implementation module which support json schema

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published