[More Detail] [Collapse All]
Feature: Pass row of input parameters in body record


  Operation '/order(post)' accepts 'Order' record as an input in
  body. 'Order' -record defines a parameter 'customers' as an array
  of sub-records type 'Customer'. Customer record has a parameter
  'address' of type 'Address'.

  The scenarios present various cases to bind parameters in
  interface operation '/order(post)'.
features/045-pass-input-parameters/015-body-row-record.feature
- Background:
link
features/045-pass-input-parameters/015-body-row-record.feature:13
Given I use a fixture named "fixture-resolver"
# ------------------------------------------------------------------
# Swagger
And YAML configuration file `cnf/interface_customer.yaml` in path `paths./order.post`
# /customer(post)

      operationId: postOrder
      parameters:
        - name: order
          in: body
          description: Order to enter
          required: true
          schema:
              $ref: '#/definitions/Order'
      responses:
         200:
            description: OK
And YAML configuration file `cnf/interface_customer.yaml` in path `definitions.Order`
#
# Order -definition

         properties:
           oid:
              type: string
           date:
              type: string
           customers:
              type: array
              items:
                  $ref: '#/definitions/Customer'
And YAML configuration file `cnf/interface_customer.yaml` in path `definitions.Customer`
#
# Customer with Address

         properties:
           id:
              type: string
           name:
              type: string
           address:
              $ref: '#/definitions/Address'
And YAML configuration file `cnf/interface_customer.yaml` in path `definitions.Address`
#
# Address definition 
#
         properties:
           street:
            type: string
           city:
            type: string
And YAML configuration file `cnf/interface_customer.yaml` in path `definitions.Address`
         properties:
           street:
            type: string
           city:
            type: string
# Swagger
# ------------------------------------------------------------------
And YAML configuration file `cnf/sbuilder.yaml`
#
# define 'setup1', which gets extended using
# configuration in 'cnf/extend_setup1.yaml'

setups:
- setupDirectory: setup1
  extensions:
     -   url: cnf/extend_setup1.yaml
And a file named "cnf/extend_setup1.yaml" with:
# Setup1:
# - set cardinality for domain 'dommi'
# - lauch /customer(get)
#
- domain-extension:
     - domain: dommi
       cardinality: 3

- step-extension:
       - interface: /order(post)
         bindExact: true
         input:
           order:
               oid: 1
               _default: 1
               customers:
                 - _default: 1
                   address:
                      _default: Nil
And YAML configuration file `cnf/sbuilder.yaml`
#
# 'resolvers' section loads resolvers from file
# 'cnf/resolver_customer.yaml'

resolvers:
     - url: cnf/resolver.yaml
And a file named "cnf/resolver.yaml" with:
# very generic resolver which matches all parameter
# sets (interfaces) and defines on catch all 
# regexp rule
-    Name: default-relsolver
     Matcher: !ruby/regexp /.*/
     Rules: 
      - Matcher: !ruby/regexp /.*/
        Domain: dommi
- Scenario: Default resolvers with two rules.
link
features/045-pass-input-parameters/015-body-row-record.feature:154
When I generate TLA+ model setup `setup1`
And I do PLC transformation for setup `setup1`
And I run TLC for setup `setup1`
And I can observe operation `/order(post)` called on time tick `0`
And I can observe domain assignement:
Field Domain
oid "d_dommi_1"
date "d_dommi_1"
id "d_dommi_1"
name "d_dommi_1"
street Nil
city Nil