cli
This commit is contained in:
16
generate.py
16
generate.py
@ -1,12 +1,19 @@
|
||||
import json
|
||||
from Cheetah.Template import Template
|
||||
import glob
|
||||
import argparse
|
||||
|
||||
with open("schema.json") as schemaFile:
|
||||
parser = argparse.ArgumentParser(description="generate.py")
|
||||
parser.add_argument('--schema', '-s',
|
||||
help='Schema file',
|
||||
required=False,
|
||||
default='./schema.json')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
with open(args.schema) as schemaFile:
|
||||
schema = json.load(schemaFile)
|
||||
|
||||
|
||||
|
||||
for table in schema["tables"]:
|
||||
for column in table["columns"]:
|
||||
if column["sqltype"] == 'serial':
|
||||
@ -28,9 +35,6 @@ for table in schema["tables"]:
|
||||
column["apitype"] = 'number'
|
||||
column["jstype"] = 'number'
|
||||
|
||||
|
||||
|
||||
|
||||
for f in glob.glob("*.tmpl"):
|
||||
print(f"process {f}")
|
||||
tmpl = Template(file=f, searchList=[schema])
|
||||
|
652
openapi.yaml
652
openapi.yaml
@ -1,652 +0,0 @@
|
||||
|
||||
|
||||
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: hv2-api
|
||||
version: "1"
|
||||
description: "REST-API for the Nober Grundbesitz GbR Hausverwaltungs-Software"
|
||||
termsOfService: "https://home.hottis.de/dokuwiki/doku.php?id=hv2pub:termsofuse"
|
||||
contact:
|
||||
name: "Wolfgang Hottgenroth"
|
||||
email: "wolfgang.hottgenroth@icloud.com"
|
||||
externalDocs:
|
||||
description: "Find more details here"
|
||||
url: "https://home.hottis.de/dokuwiki/doku.php?id=hv2pub:externaldocs"
|
||||
|
||||
paths:
|
||||
/v1/accounts:
|
||||
get:
|
||||
tags: [ "account" ]
|
||||
summary: Return all normalized accounts
|
||||
operationId: methods.get_accounts
|
||||
responses:
|
||||
'200':
|
||||
description: accounts response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/account'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/accounts/{accountId}:
|
||||
get:
|
||||
tags: [ "account" ]
|
||||
summary: Return the normalized account with given id
|
||||
operationId: methods.get_account
|
||||
parameters:
|
||||
- name: accountId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: account response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/account'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/tenants:
|
||||
get:
|
||||
tags: [ "tenant" ]
|
||||
summary: Return all normalized tenants
|
||||
operationId: methods.get_tenants
|
||||
responses:
|
||||
'200':
|
||||
description: tenants response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/tenant'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/tenants/{tenantId}:
|
||||
get:
|
||||
tags: [ "tenant" ]
|
||||
summary: Return the normalized tenant with given id
|
||||
operationId: methods.get_tenant
|
||||
parameters:
|
||||
- name: tenantId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: tenant response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/tenant'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/premises:
|
||||
get:
|
||||
tags: [ "premise" ]
|
||||
summary: Return all normalized premises
|
||||
operationId: methods.get_premises
|
||||
responses:
|
||||
'200':
|
||||
description: premises response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/premise'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/premises/{premiseId}:
|
||||
get:
|
||||
tags: [ "premise" ]
|
||||
summary: Return the normalized premise with given id
|
||||
operationId: methods.get_premise
|
||||
parameters:
|
||||
- name: premiseId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: premise response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/premise'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/flats:
|
||||
get:
|
||||
tags: [ "flat" ]
|
||||
summary: Return all normalized flats
|
||||
operationId: methods.get_flats
|
||||
responses:
|
||||
'200':
|
||||
description: flats response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/flat'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/flats/{flatId}:
|
||||
get:
|
||||
tags: [ "flat" ]
|
||||
summary: Return the normalized flat with given id
|
||||
operationId: methods.get_flat
|
||||
parameters:
|
||||
- name: flatId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: flat response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/flat'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/overhead_advances:
|
||||
get:
|
||||
tags: [ "overhead_advance" ]
|
||||
summary: Return all normalized overhead_advances
|
||||
operationId: methods.get_overhead_advances
|
||||
responses:
|
||||
'200':
|
||||
description: overhead_advances response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/overhead_advance'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/overhead_advances/{overhead_advanceId}:
|
||||
get:
|
||||
tags: [ "overhead_advance" ]
|
||||
summary: Return the normalized overhead_advance with given id
|
||||
operationId: methods.get_overhead_advance
|
||||
parameters:
|
||||
- name: overhead_advanceId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: overhead_advance response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/overhead_advance'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/overhead_advance_flat_mappings:
|
||||
get:
|
||||
tags: [ "overhead_advance_flat_mapping" ]
|
||||
summary: Return all normalized overhead_advance_flat_mappings
|
||||
operationId: methods.get_overhead_advance_flat_mappings
|
||||
responses:
|
||||
'200':
|
||||
description: overhead_advance_flat_mappings response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/overhead_advance_flat_mapping'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/overhead_advance_flat_mappings/{overhead_advance_flat_mappingId}:
|
||||
get:
|
||||
tags: [ "overhead_advance_flat_mapping" ]
|
||||
summary: Return the normalized overhead_advance_flat_mapping with given id
|
||||
operationId: methods.get_overhead_advance_flat_mapping
|
||||
parameters:
|
||||
- name: overhead_advance_flat_mappingId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: overhead_advance_flat_mapping response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/overhead_advance_flat_mapping'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/parkings:
|
||||
get:
|
||||
tags: [ "parking" ]
|
||||
summary: Return all normalized parkings
|
||||
operationId: methods.get_parkings
|
||||
responses:
|
||||
'200':
|
||||
description: parkings response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/parking'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/parkings/{parkingId}:
|
||||
get:
|
||||
tags: [ "parking" ]
|
||||
summary: Return the normalized parking with given id
|
||||
operationId: methods.get_parking
|
||||
parameters:
|
||||
- name: parkingId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: parking response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/parking'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/commercial_premises:
|
||||
get:
|
||||
tags: [ "commercial_premise" ]
|
||||
summary: Return all normalized commercial_premises
|
||||
operationId: methods.get_commercial_premises
|
||||
responses:
|
||||
'200':
|
||||
description: commercial_premises response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/commercial_premise'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/commercial_premises/{commercial_premiseId}:
|
||||
get:
|
||||
tags: [ "commercial_premise" ]
|
||||
summary: Return the normalized commercial_premise with given id
|
||||
operationId: methods.get_commercial_premise
|
||||
parameters:
|
||||
- name: commercial_premiseId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: commercial_premise response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/commercial_premise'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/tenancys:
|
||||
get:
|
||||
tags: [ "tenancy" ]
|
||||
summary: Return all normalized tenancys
|
||||
operationId: methods.get_tenancys
|
||||
responses:
|
||||
'200':
|
||||
description: tenancys response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/tenancy'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/tenancys/{tenancyId}:
|
||||
get:
|
||||
tags: [ "tenancy" ]
|
||||
summary: Return the normalized tenancy with given id
|
||||
operationId: methods.get_tenancy
|
||||
parameters:
|
||||
- name: tenancyId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: tenancy response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/tenancy'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/fees:
|
||||
get:
|
||||
tags: [ "fee" ]
|
||||
summary: Return all normalized fees
|
||||
operationId: methods.get_fees
|
||||
responses:
|
||||
'200':
|
||||
description: fees response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/fee'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/fees/{feeId}:
|
||||
get:
|
||||
tags: [ "fee" ]
|
||||
summary: Return the normalized fee with given id
|
||||
operationId: methods.get_fee
|
||||
parameters:
|
||||
- name: feeId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: fee response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/fee'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/tenancy_fee_mappings:
|
||||
get:
|
||||
tags: [ "tenancy_fee_mapping" ]
|
||||
summary: Return all normalized tenancy_fee_mappings
|
||||
operationId: methods.get_tenancy_fee_mappings
|
||||
responses:
|
||||
'200':
|
||||
description: tenancy_fee_mappings response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/tenancy_fee_mapping'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/tenancy_fee_mappings/{tenancy_fee_mappingId}:
|
||||
get:
|
||||
tags: [ "tenancy_fee_mapping" ]
|
||||
summary: Return the normalized tenancy_fee_mapping with given id
|
||||
operationId: methods.get_tenancy_fee_mapping
|
||||
parameters:
|
||||
- name: tenancy_fee_mappingId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: tenancy_fee_mapping response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/tenancy_fee_mapping'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/account_entrys:
|
||||
get:
|
||||
tags: [ "account_entry" ]
|
||||
summary: Return all normalized account_entrys
|
||||
operationId: methods.get_account_entrys
|
||||
responses:
|
||||
'200':
|
||||
description: account_entrys response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/account_entry'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
/v1/account_entrys/{account_entryId}:
|
||||
get:
|
||||
tags: [ "account_entry" ]
|
||||
summary: Return the normalized account_entry with given id
|
||||
operationId: methods.get_account_entry
|
||||
parameters:
|
||||
- name: account_entryId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: account_entry response
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/account_entry'
|
||||
security:
|
||||
- jwt: ['secret']
|
||||
|
||||
components:
|
||||
securitySchemes:
|
||||
jwt:
|
||||
type: http
|
||||
scheme: bearer
|
||||
bearerFormat: JWT
|
||||
x-bearerInfoFunc: auth.decodeToken
|
||||
schemas:
|
||||
account:
|
||||
description: account
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
tenant:
|
||||
description: tenant
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
salutation:
|
||||
type: string
|
||||
firstname:
|
||||
type: string
|
||||
lastname:
|
||||
type: string
|
||||
address1:
|
||||
type: string
|
||||
address2:
|
||||
type: string
|
||||
address3:
|
||||
type: string
|
||||
zip:
|
||||
type: string
|
||||
city:
|
||||
type: string
|
||||
phone1:
|
||||
type: string
|
||||
phone2:
|
||||
type: string
|
||||
iban:
|
||||
type: string
|
||||
account:
|
||||
type: integer
|
||||
premise:
|
||||
description: premise
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
street:
|
||||
type: string
|
||||
zip:
|
||||
type: string
|
||||
city:
|
||||
type: string
|
||||
flat:
|
||||
description: flat
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
premise:
|
||||
type: integer
|
||||
area:
|
||||
type: number
|
||||
flat_no:
|
||||
type: integer
|
||||
overhead_advance:
|
||||
description: overhead_advance
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
amount:
|
||||
type: number
|
||||
startdate:
|
||||
type: string
|
||||
enddate:
|
||||
type: string
|
||||
overhead_advance_flat_mapping:
|
||||
description: overhead_advance_flat_mapping
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
overhead_advance:
|
||||
type: integer
|
||||
flat:
|
||||
type: integer
|
||||
parking:
|
||||
description: parking
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
premise:
|
||||
type: integer
|
||||
commercial_premise:
|
||||
description: commercial_premise
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
premise:
|
||||
type: integer
|
||||
tenancy:
|
||||
description: tenancy
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
tenant:
|
||||
type: integer
|
||||
flat:
|
||||
type: integer
|
||||
parking:
|
||||
type: integer
|
||||
commercial_premise:
|
||||
type: integer
|
||||
startdate:
|
||||
type: string
|
||||
enddate:
|
||||
type: string
|
||||
fee:
|
||||
description: fee
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
amount:
|
||||
type: number
|
||||
fee_type:
|
||||
type: string
|
||||
startdate:
|
||||
type: string
|
||||
enddate:
|
||||
type: string
|
||||
tenancy_fee_mapping:
|
||||
description: tenancy_fee_mapping
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
tenancy:
|
||||
type: integer
|
||||
fee:
|
||||
type: integer
|
||||
account_entry:
|
||||
description: account_entry
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
account:
|
||||
type: integer
|
||||
created_at:
|
||||
type: string
|
||||
amount:
|
||||
type: number
|
Reference in New Issue
Block a user