pallets-eco / flask-api-examples Goto Github PK
View Code? Open in Web Editor NEWLicense: BSD 3-Clause "New" or "Revised" License
License: BSD 3-Clause "New" or "Revised" License
I have a flask api example app solely using view functions. https://github.com/nuvic/flask_for_startups
The readme explains the motivation behind it. Would this be something that would be helpful for pallets-eco? If you think it needs modifications, I'd be happy to make the changes.
I'm thinking of creating a pet store example with the following setup and endpoints.
Common Setup:
Pet
model.
Endpoints:
{
"components": {
"schemas": {
"PetIn": {
"properties": {
"category": {
"enum": [
"dog",
"cat"
],
"type": "string"
},
"name": {
"maxLength": 10,
"minLength": 0,
"type": "string"
}
},
"required": [
"category",
"name"
],
"type": "object"
},
"PetInUpdate": {
"properties": {
"category": {
"enum": [
"dog",
"cat"
],
"type": "string"
},
"name": {
"maxLength": 10,
"minLength": 0,
"type": "string"
}
},
"type": "object"
},
"PetOut": {
"properties": {
"category": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
},
"type": "object"
},
"ValidationError": {
"properties": {
"detail": {
"properties": {
"<location>": {
"properties": {
"<field_name>": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
}
},
"type": "object"
},
"message": {
"type": "string"
},
"status_code": {
"type": "integer"
}
},
"type": "object"
}
}
},
"info": {
"title": "APIFlask",
"version": "0.1.0"
},
"openapi": "3.0.3",
"paths": {
"/": {
"get": {
"parameters": [],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {}
}
},
"description": "Successful response"
}
},
"summary": "Say Hello"
}
},
"/pets": {
"get": {
"parameters": [],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/PetOut"
},
"type": "array"
}
}
},
"description": "Successful response"
}
},
"summary": "Get Pets"
},
"post": {
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PetIn"
}
}
}
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PetOut"
}
}
},
"description": "Successful response"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationError"
}
}
},
"description": "Validation error"
}
},
"summary": "Create Pet"
}
},
"/pets/{pet_id}": {
"delete": {
"parameters": [
{
"in": "path",
"name": "pet_id",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"204": {
"description": "Successful response"
}
},
"summary": "Delete Pet"
},
"get": {
"parameters": [
{
"in": "path",
"name": "pet_id",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PetOut"
}
}
},
"description": "Successful response"
}
},
"summary": "Get Pet"
},
"patch": {
"parameters": [
{
"in": "path",
"name": "pet_id",
"required": true,
"schema": {
"type": "integer"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PetInUpdate"
}
}
}
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PetOut"
}
}
},
"description": "Successful response"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationError"
}
}
},
"description": "Validation error"
}
},
"summary": "Update Pet"
}
}
},
"tags": []
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.