question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example string of type integer gets pasted as int

See original GitHub issue

When I use autocompletion I get a nice suggestion to use '1' (so obviously this entry in examples is a string), but after selecting it it ends up as 1, giving me an error as the validation spec expects a string.

Maybe this is a vscode problem, but I am reporting here first.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JPinkneycommented, Oct 21, 2020

I can change code completion to surround numbers, booleans and null values with " in case if schema requires string but the default value is other than string.

Yeah, that sounds good to me

0reactions
evidolobcommented, Oct 21, 2020

@JPinkney I done some investigation on this, and found that YAML doesn’t have number type, it has only scalar type, i.e. for yaml point of view 1, '1', "1" is represents same value(string witch contains ‘1’) in different flow scalar types I can change code completion to surround numbers, booleans and null values with " in case if schema requires string but default value is other than string. Or I can improve schema validation, by adding type conventions, i.e. if scheme requires number but we parse string, we will try to convert that string to number and do rest validations.

WDYT?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java String to Int – How to Convert a String to an Integer
This method returns the string as a primitive type int. ... Let's consider an example of converting a string to an int using...
Read more >
How to convert string to int in C#? - TutorialsTeacher
In C#, you can convert a string representation of a number to an integer using the following ways: Parse() method. Convert class.
Read more >
How To Convert Java String To Int - Tutorial With Examples
This tutorial explains the ways to convert Java String to Integer using Integer.parseInt and Integer.ValueOf methods with code examples.
Read more >
How do I convert a String to an int in Java? - Stack Overflow
For example, here are two ways: Integer x = Integer.valueOf ...
Read more >
4 Ways to Convert String to Int in Java - YouTube
valueOf() method converts String into Integer object Other query related to this code: How to convert string to integer in java how to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found