wwpp codegen
usage
npm install wwpm-codegen -g
wwgen -s ./schema/ -o ./output -ns com.tianpeng
definition spec
a) ./schema/common.js
//common struct difinition(first char is upper case!)exportsProduct =id: type: "integer" //define a integer typename: type: "string" //define a string typeprovider://define a ref object type$ref:"common#ProductProvider"price:type: "number"//define a float typeminimum: 0exclusiveMinimum: trueexportsProductProvider =id: type: "integer"name: type: "string"tel: type: "string"email: type: "string"
b) ./schema/product.js
//resource interface difinition//path is required, and any http methods:get ,post,delete....exportspath = "/product/:id"exportsget =schema:request:id:type:'integer'//ignore input define,got from routerresponse:value:ref:'common#Product'error:type:'integer'optional:true{thisvalue = {...}return '/product.xhtml'}exportspost=schema:request:ref:'common#Product'response:error:type:'integer'optional:true{await//no view returend and model(this) is stringify as json}