loopback icon indicating copy to clipboard operation
loopback copied to clipboard

Invalid default value when entering a property.

Open cgole opened this issue 10 years ago • 2 comments

Installed today's build, 7/14/2016. Getting a warning message when trying to not provide a default value for a property. It's says "Default value(leave blank for none". When I do that, it give me the warning message below and forces me to put in a default. I put in a "blank" and it accepted it, but then the "apic validate" gives me an error.

[root@kvm7rh61 rateplanuntwos47]# apic create --type model
Logger configured by: /root/.apiconnect/logger-config.js
? Enter the model name: rateplanuntwos47
? Select the data-source to attach rateplanuntwos47 to: db (memory)
? Select model's base class PersistedModel
? Expose rateplanuntwos47 via the REST API? Yes
? Custom plural form (used to build REST URL): 
? Common model or server only? common
Let's add some rateplanuntwos47 properties now.

Enter an empty property name when done.
? Property name: title
   invoke   loopback:property
? Property type: string
? Required? No
? Default value[leave blank for none]: 
Warning: please enter the title property again. The default value provided "" is not valid for type: string
? Property type: string
? Required? No
? Default value[leave blank for none]: 
Warning: please enter the title property again. The default value provided "" is not valid for type: string
? Property type: string
? Required? No
? Default value[leave blank for none]:  

Let's add another rateplanuntwos47 property.
Enter an empty property name when done.
? Property name: content
   invoke   loopback:property
? Property type: string
? Required? No
? Default value[leave blank for none]:  

Let's add another rateplanuntwos47 property.
Enter an empty property name when done.
? Property name: created
   invoke   loopback:property
? Property type: date
? Required? No
? Default value[leave blank for none]: 
Warning: please enter the created property again. The default value provided "" is not valid for type: date
? Property type: date
? Required? No
? Default value[leave blank for none]:  

Let's add another rateplanuntwos47 property.
Enter an empty property name when done.
? Property name: 
Done running LoopBack generator

Updating swagger and product definitions
Created /root/APPs/rateplanuntwos47/definitions/rateplanuntwos47.yaml swagger description
[root@kvm7rh61 rateplanuntwos47]# cd definitions/
[root@kvm7rh61 definitions]# ls -l
total 32
-rw-r--r-- 1 root root   383 Jul 14 11:52 rateplanuntwos47-product.yaml
-rw-r--r-- 1 root root 28583 Jul 14 11:57 rateplanuntwos47.yaml
[root@kvm7rh61 definitions]# apic validate rateplanuntwos47-product.yaml
Logger configured by: /root/.apiconnect/logger-config.js
Successfully validated rateplanuntwos47-product.yaml against API Connect product schema product definition [rateplanuntwos47:1.0.0].
Error validating rateplanuntwos47.yaml with Swagger Version 2.0 schema API definition [rateplanuntwos47:1.0.0].
  Expected type string but found type null
Successfully validated rateplanuntwos47.yaml against API Connect swagger extensions schema API definition [rateplanuntwos47:1.0.0].
Successfully validated rateplanuntwos47.yaml against IBM Swagger Version 2.0 schema API definition [rateplanuntwos47:1.0.0].
Error: Validation did not complete successfully.
[root@kvm7rh61 definitions]# ^C

https://github.ibm.com/apimesh/scrum-platform-foundation/issues/1258

cgole avatar Jul 21 '16 21:07 cgole

@cgole : Looks like this is a duplicate: https://github.com/strongloop/loopback/issues/2518

gunjpan avatar Jul 22 '16 13:07 gunjpan

dup

cgole avatar Jul 22 '16 16:07 cgole