sigoden / apitest

Apitest is declarative api testing tool with JSON-like DSL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add @optional

sigoden opened this issue · comments

Some api may return some optional fields, which will be returned when the field has a value.

In this case, it is necessary to add an annotation @optional

{
  test1: { @client("echo")
    req: {
      v1: 3,
      // v2: 4, optional field
    },
    res: {
      v1: 3,
      v2: 4, @optional
    }
  }
}

Can be used with other annotations

{
  test1: { @client("echo")
    req: {
      v1: 3,
      // v2: 4, optional filed
    },
    res: {
      v1: 3,
      v2: 0, @type @optional
    }
  }
}