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.

Support C#7 value tuples

See original GitHub issue

Add support for c# 7 value tuple. Example. Consider following action

        public (IEnumerable<string> Collection, string Token) TestAction()
        {
            return (new string[] { "value1", "value2" }, "TokenValue");
        }

expected definition:

 "definitions": {
    "ValueTuple[IEnumerable[String],String]": {
      "type": "object",
      "properties": {
        "Collection": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "Token": {
          "type": "string"
        }
      }
    }
  },

actual definition

 "definitions": {
    "ValueTuple[IEnumerable[String],String]": {
      "type": "object",
      "properties": {
        "item1": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "item2": {
          "type": "string"
        }
      }
    }
  },

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:6
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Soarccommented, Nov 16, 2017

ValueTuples can be treated as simple objects with well known property names matching values defined in generated TupleElementNamesAttribute. The only problem i can see is generating definition name.

0reactions
Leonardo-Ferreiracommented, Oct 16, 2022

any news here? im kinda having a problem here also… It is worth noting that if you use List<KeyValuePair<string,string>> the output is field:[{key:string,value:string}], so why not have List<(string Name, string Email)> rendered as field:[{Name:string,Email:string}]

Read more comments on GitHub >

github_iconTop Results From Across the Web

C#7: Tuples - somewhat abstract
To support the new C#7 feature, there is a new tuple type that is more performant and better suited to the awesomeness that...
Read more >
c# - C#7 value tuple/deconstruction asymmetry
Value tuples are the kind of syntactic-sugar feature where it does what it looks like it does, and never mind the implementation details....
Read more >
Dissecting the tuples in C# 7 - Developer Support
Tuples can be “deconstructed” but only into “variable declaration” but not into “out var” or in the case block: var (x, y) =...
Read more >
C# 7 Makes Tuples Cool!
So what's new with Tuples? In C# 7.0, there is a new feature that allows for multiple values to be returned from a...
Read more >
Tuples in C#7
One of the nice features in C#7 is the support for Tuples as a lightweight datastructure using the System.ValueTuple NuGet package.
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