ibm-apiconnect / cli

API Connect v5 Getting Started: Developer Toolkit Command Line Interface
22 stars 9 forks source link

Validation fails for valid YML #3

Open metin opened 7 years ago

metin commented 7 years ago

Hi, I think validate command does not work correctly for properties. When value for a property is all numbers and there is no quote around it, validate command says it is invalid. Here is the exact message;

C:\Users\is96933\work\validate_bug>apic validate definitions\validate_bug.yaml
Successfully validated validate_bug.yaml against Swagger Version 2.0 schema API definition [validate_bug:1.0.0].
Error validating validate_bug.yaml with API Connect swagger extensions schema API definition [validate_bug:1.0.0].
  Invalid type: number (expected string) (/properties/my_property/value)
Successfully validated validate_bug.yaml against IBM Swagger Version 2.0 schema API definition [validate_bug:1.0.0].
Error: Validation did not complete successfully.

There is no way to express type of the property but it complains about value of string property to be number. I think either it should allow setting type or take everything as string. It is valid against swagger 2.0 anyway.

This was fine in older versions like 2.5.21

This is the definition I used

swagger: '2.0'
info:
  x-ibm-name: validate_bug
  version: 1.0.0
  title: validate_bug
schemes:
  - https
host: $(catalog.host)
basePath: /api
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  clientIdHeader:
    type: apiKey
    in: header
    name: X-IBM-Client-Id
  clientSecretHeader:
    in: header
    name: X-IBM-Client-Secret
    type: apiKey
security:
  - clientIdHeader: []
    clientSecretHeader: []
x-ibm-configuration:
  testable: true
  enforced: true
  cors:
    enabled: true
  catalogs:
    apic-dev:
      properties:
        runtime-url: $(TARGET_URL)
    sb:
      properties:
        runtime-url: 'http://localhost:4001'
  assembly:
    execute:
      - invoke:
          target-url: $(runtime-url)$(request.path)$(request.search)
  properties:
    my_property:
      value: 1234
      description: ''
      encoded: false
paths: {}
definitions: {}

Version info;

C:\Users\is96933\work\validate_bug>apic --ext-version
apiconnect: v2.6.71 (API Connect: v5.0.7.2)
 apiconnect-cli-apis 2.5.4 (c16932ea6f9ce0da6ecae14c8f17ed3811711fb9)
 apiconnect-cli-apps 2.7.6 (de231d82005a67f6923a5b780b93e0abbcf94dbd)
 apiconnect-cli-auth 3.1.2 (e4c977d434ad289606210b56191d49a1141cc9ca)
 apiconnect-cli-catalogs 2.5.3 (c70d5afa9c3933ae5428c4218f3255e203523ee1)
 apiconnect-cli-components 1.1.3 (8ed6ad25c32b51421e1096707f442b2e3e9344a4)
 apiconnect-cli-config 3.0.13
 apiconnect-cli-create 2.6.11
 apiconnect-cli-devapps 1.3.3 (6570dbfd156c0f9b2ba95af32effba878515af5b)
 apiconnect-cli-drafts 2.7.4 (567abe5683cc1bfbbb3f3ccc51d8b039e41375f8)
 apiconnect-cli-edit 3.0.9 (13200845f0527769e84ca230fafe409ce181f4d1)
 apiconnect-cli-explore 1.1.3 (8cb111011a776e30f85489203b24b6a8e023f133)
 apiconnect-cli-extensions 1.0.3 (4a498f0f1d140b1e10868119b74a7acc4938f387)
 apiconnect-cli-loopback 2.6.4 (84a83513c7138a33dfc592aac1879401f3ed297f)
 apiconnect-cli-members 1.1.4 (1ac6ffad945af98f992d49fc2163f2e8a4400723)
 apiconnect-cli-orgs 2.5.3 (0e8900be22b260c2b8b60b97e2fcf68645fbb9ab)
 apiconnect-cli-pm 2.4.4 (ffdde8e886d3c1a4eeb1913176a610596e887a1b)
  apiconnect-mgmt-lite-datapower 1.0.10
  microgateway 1.6.3
   flow-engine 1.1.2
 apiconnect-cli-policies 1.5.3 (1713039171a89bf682cfb19948010f58ff14a6cf)
 apiconnect-cli-products 2.8.3 (d58cb3255be5b77e6a329a7da5aa0617ca9ecbd1)
 apiconnect-cli-securegateways 1.1.3 (47bf8255dc0431f500a05c1e6db0a860479bf0a0)
 apiconnect-cli-spaces 1.1.3 (c6351e1a715a1fc6b231b87870af65ee2a0a471a)
 apiconnect-cli-subscriptions 1.2.4 (08fe29996f03f5ce4cc1a701af462765cd5c7bbb)
 apiconnect-cli-swiftserver 1.0.8 (367d078ed7da1398ea1bf6d3fa7bf0e646facfae)
 apiconnect-cli-validate 2.3.9 (0acf28bd39384be4e6c6e9852928cde7f014bd53)
 apiconnect-cli-version-checker 1.3.3 (83ae5a23aa7792e3a6859ba456f1f0d59d7527f5)
 apiconnect-tracking 1.2.3
 plugins 3.3.9
smartmouse commented 5 years ago

Please try the latest apiconnect version apiconnect@4.0.24 apic-v5.0.8.6-iFix