[More Detail] [Collapse All]
Feature: Pass input in two body records

Pass input in 2 body record.
features/045-pass-input-parameters/006-two-body-records.feature
- Background:
link

Operation '/customer(post)' inputs 'Customer' and 'Address' records in
body.
features/045-pass-input-parameters/006-two-body-records.feature:6
# ------------------------------------------------------------------
# swagger configuration:
Given I successfully run `sbuilder.rb init`
And I successfully run `sbuilder.rb extend`
Given a file named "cnf/sbuilder.yaml" with:
#
# Define public application interface and 
# private infrastrctureu interface

interfaces:
    -  className: Sbuilder::ParamSetLoaderSwagger
       file: interface.yaml
Given a file named "cnf/interface.yaml" with:
 swagger: "2.0"
 info:
    version: 1.0.0
    title: TLA-sbuilder demo application public interface
 host: localhost
 basePath: /api
 schemes:
     - http
 consumes:
     - application/json
 produces:
    - application/json
 paths:
    /customer:
      post: 
         parameters:
            - name: customer
              in: body
              description: Customers to enter
              required: true
              schema:
                  $ref: '#/definitions/Customer'
            - name: address
              in: body
              description: Address to enter
              required: true
              schema:
                  $ref: '#/definitions/Address'
         responses:
             200:
                description: OK
 definitions: 
    Customer:
         properties:
           id:
            type: string
           name:
            type: string
    Address:
         properties:
           street:
            type: string
           city:
            type: string
# ------------------------------------------------------------------
And YAML configuration file `cnf/sbuilder.yaml`
#
# 'setups' section defines a setup 'setup1' 

setups:
- setupDirectory: setup1
  extensions:
      -  url: cnf/extend_setup1.yaml
And a file named "cnf/extend_setup1.yaml" with:
# Setup1:

# - call /customer(post), all fields in 'customer'
#   records have default value 1.
#
- step-extension:
       - interface: /customer(post)
         input:
           customer:
               _default: 1
           address:
               street: 1
               city: 0
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:
# default resolver with one regexp rule
# --> all fields are mapped to domain 'dommi'
-    Name: default-relsolver
     Matcher: !ruby/regexp /.*/
     Rules: 
      - Matcher: street
        Domain: street
      - Matcher: !ruby/regexp /.*/
        Domain: dommi
- Scenario: Call /customer(post) with query parmeters
link
features/045-pass-input-parameters/006-two-body-records.feature:134
When I generate TLA+ model setup `setup1`
And I cd to "gen/setup1/tla"
And I successfully run command `java -cp $TLATOOLS pcal.trans model`
And I successfully run command `java -cp $TLATOOLS tlc2.TLC setup`
And I can observe operation `/customer(post)` called on time tick `0`
And I can observe domain assignement:
Field Domain
id "d_dommi_1"
name "d_dommi_1"
street "d_street_1"
city Nil