github.com/mmatczuk/gohan@v0.0.0-20170206152520-30e45d9bdb69/examples/npm_example/example_schema.yaml (about)

     1  # Pet Store Schema
     2  schemas:
     3  - description: base resource definition
     4    id: base
     5    plural: bases
     6    prefix: /v1.0
     7    type: abstract
     8    schema:
     9      properties:
    10        description:
    11          description: Description
    12          permission:
    13          - create
    14          - update
    15          title: Description
    16          type: string
    17        id:
    18          description: ID
    19          permission:
    20          - create
    21          title: ID
    22          type: string
    23          view:
    24          - detail
    25        name:
    26          description: Name
    27          permission:
    28          - create
    29          - update
    30          title: Name
    31          type: string
    32        tenant_id:
    33          description: Tenant ID
    34          permission:
    35          - create
    36          title: Tenant ID
    37          type: string
    38          view:
    39          - detail
    40      propertiesOrder:
    41      - id
    42      - name
    43      - tenant_id
    44      - description
    45      required: []
    46      type: object
    47    singular: base
    48    title: Base Resource
    49  - description: pet
    50    id: pet
    51    plural: pets
    52    extends:
    53    - base
    54    prefix: /v1.0/store
    55    schema:
    56      properties:
    57        status:
    58          description: Status
    59          permission:
    60          - create
    61          - update
    62          title: Status
    63          type: string
    64          enum:
    65          - available
    66          - pending
    67          - sold
    68      propertiesOrder:
    69      - status
    70      required: []
    71      type: object
    72    singular: pet
    73    title: Pet
    74  extensions:
    75  - id: schema
    76    code_type: javascript
    77    code: |
    78      gohan_register_handler("pre_list", function (context){
    79          var underscore = require('underscore');
    80          console.log(underscore.min([3,2,1]));
    81      });
    82    path: /v1.0/store/pets