All Projects → rightlag → Aptos

rightlag / Aptos

Licence: mit
☀️ Avro, Protobuf, Thrift on Swagger

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Aptos

Simplemall
基于SpringCloud的微服务架构实战案例项目,以一个简单的购物流程为示例,融合spring cloud 相关组件,如spring-cloud-netflix、swagger等
Stars: ✭ 687 (+3941.18%)
Mutual labels:  swagger
Javaquarkbbs
基于Spring Boot实现的一个简易的Java社区
Stars: ✭ 755 (+4341.18%)
Mutual labels:  swagger
Oapi Codegen
Generate Go client and server boilerplate from OpenAPI 3 specifications
Stars: ✭ 806 (+4641.18%)
Mutual labels:  swagger
Swagger Parser
Swagger 2.0 and OpenAPI 3.0 parser/validator
Stars: ✭ 710 (+4076.47%)
Mutual labels:  swagger
Node Typescript Koa Rest
REST API boilerplate using NodeJS and KOA2, typescript. Logging and JWT as middlewares. TypeORM with class-validator, SQL CRUD. Docker included. Swagger docs, actions CI and valuable README
Stars: ✭ 739 (+4247.06%)
Mutual labels:  swagger
Optic
Optic documents and tests your API as you build it
Stars: ✭ 760 (+4370.59%)
Mutual labels:  swagger
Abp Asp.net Boilerplate Project Cms
ABP module-zero +AdminLTE+Bootstrap Table+jQuery+Redis + sql server+quartz+hangfire权限管理系统
Stars: ✭ 677 (+3882.35%)
Mutual labels:  swagger
Swagger Axios Converter
swagger axios converter
Stars: ✭ 16 (-5.88%)
Mutual labels:  swagger
Mica
Spring Cloud 微服务开发核心工具集。工具类、验证码、http、redis、ip2region、xss 等,开箱即用。 🔝 🔝 记得右上角点个star 关注更新!
Stars: ✭ 749 (+4305.88%)
Mutual labels:  swagger
Springbootexamples
Spring Boot 学习教程
Stars: ✭ 794 (+4570.59%)
Mutual labels:  swagger
Kafka Storm Starter
Code examples that show to integrate Apache Kafka 0.8+ with Apache Storm 0.9+ and Apache Spark Streaming 1.1+, while using Apache Avro as the data serialization format.
Stars: ✭ 728 (+4182.35%)
Mutual labels:  avro
Swagger
OpenAPI (Swagger) module for Nest framework (node.js) 🌎
Stars: ✭ 734 (+4217.65%)
Mutual labels:  swagger
Kin Openapi
OpenAPI 3.0 implementation for Go (parsing, converting, validation, and more)
Stars: ✭ 776 (+4464.71%)
Mutual labels:  swagger
Yada
A powerful Clojure web library, full HTTP, full async - see https://juxt.pro/yada/index.html
Stars: ✭ 706 (+4052.94%)
Mutual labels:  swagger
Swagger To Graphql
Swagger to GraphQL API adapter
Stars: ✭ 811 (+4670.59%)
Mutual labels:  swagger
Pmacct
pmacct is a small set of multi-purpose passive network monitoring tools [NetFlow IPFIX sFlow libpcap BGP BMP RPKI IGP Streaming Telemetry].
Stars: ✭ 677 (+3882.35%)
Mutual labels:  avro
Spring Cloud Netflix Example
spring-cloud-netflix-example is an example for microservices system
Stars: ✭ 760 (+4370.59%)
Mutual labels:  swagger
Openapi Gui
GUI / visual editor for creating and editing OpenAPI / Swagger definitions
Stars: ✭ 891 (+5141.18%)
Mutual labels:  swagger
Apispec
A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification)..
Stars: ✭ 831 (+4788.24%)
Mutual labels:  swagger
Schemathesis
A modern API testing tool for web applications built with Open API and GraphQL specifications.
Stars: ✭ 768 (+4417.65%)
Mutual labels:  swagger



aptos


aptos (Avro, Protobuf, Thrift on Swagger) is a module that parses JSON Schema documents to validate client-submitted data and convert JSON schema documents to Avro, Protobuf, or Thrift serialization formats.

JSON Schema defines the media type "application/schema+json", a JSON-based format for describing the structure of JSON data.

Usage

aptos supports validating client-submitted data and generating Avro, Protobuf, and Thrift structured messages from a given JSON Schema document.

Data Validation

Given a JSON Schema document, aptos can validate client-submitted data to require that it satisfies a certain number of criteria.

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Product",
    "type": "object",
    "definitions": {
        "geo": {
            "$schema": "http://json-schema.org/draft-04/schema#",
            "description": "A geographical coordinate",
            "type": "object",
            "properties": {
                "latitude": { "type": "number" },
                "longitude": { "type": "number" }
            }
        }
    },
    "properties": {
        "id": {
            "description": "The unique identifier for a product",
            "type": "number"
        },
        "name": {
            "type": "string"
        },
        "price": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
        },
        "tags": {
            "type": "array",
            "items": {
                "type": "string"
            },
            "minItems": 1,
            "uniqueItems": true
        },
        "dimensions": {
            "type": "object",
            "properties": {
                "length": {"type": "number"},
                "width": {"type": "number"},
                "height": {"type": "number"}
            },
            "required": ["length", "width", "height"]
        },
        "warehouseLocation": {
            "description": "Coordinates of the warehouse with the product",
            "$ref": "#/definitions/geo"
        }
    },
    "required": ["id", "name", "price"]
}

Validation keywords such as uniqueItems, required, and minItems can be used in a schema to impose requirements for successful validation of an instance.

import json

from aptos.util import Parser
from aptos.visitors import ValidationVisitor

record = Parser.parse('/path/to/schema')
# Valid client-submitted data (instance)
instance = {
    "id": 2,
    "name": "An ice sculpture",
    "price": 12.50,
    "tags": ["cold", "ice"],
    "dimensions": {
        "length": 7.0,
        "width": 12.0,
        "height": 9.5
    },
    "warehouseLocation": {
        "latitude": -78.75,
        "longitude": 20.4
    }
}
record.accept(ValidationVisitor(instance))

Structured Message Generation

Given a JSON Schema document, aptos can generate structured messages including Avro, Protobuf, and Thrift.

Avro

For brevity, the Product schema is omitted from the example.

import json

from aptos.util import Parser
from aptos.visitors import RecordVisitor

record = Parser.parse('/path/to/schema')
schema = record.accept(RecordVisitor())
print(json.dumps(schema, indent=2))

The preceding code generates the following Avro schema:

{
  "namespace": "aptos.visitors",
  "fields": [
    {
      "type": "long",
      "doc": "The unique identifier for a product",
      "name": "id"
    },
    {
      "type": {
        "items": "string",
        "type": "array"
      },
      "doc": "",
      "name": "tags"
    },
    {
      "type": {
        "namespace": "aptos.visitors",
        "fields": [
          {
            "type": "long",
            "doc": "",
            "name": "latitude"
          },
          {
            "type": "long",
            "doc": "",
            "name": "longitude"
          }
        ],
        "type": "record",
        "doc": "A geographical coordinate",
        "name": ""
      },
      "doc": "A geographical coordinate",
      "name": "warehouseLocation"
    },
    {
      "type": "string",
      "doc": "",
      "name": "name"
    },
    {
      "type": {
        "namespace": "aptos.visitors",
        "fields": [
          {
            "type": "long",
            "doc": "",
            "name": "width"
          },
          {
            "type": "long",
            "doc": "",
            "name": "height"
          },
          {
            "type": "long",
            "doc": "",
            "name": "length"
          }
        ],
        "type": "record",
        "doc": "",
        "name": ""
      },
      "doc": "",
      "name": "dimensions"
    },
    {
      "type": "long",
      "doc": "",
      "name": "price"
    }
  ],
  "type": "record",
  "doc": "",
  "name": "Product"
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].