Skip to content

Converting JSON to values in code fixes #4612

Open

Description

Clear and concise description of the problem

People may have JSON on hand when trying to create examples for their models, but examples are expected to be values.

It would be nice if the existing "convert to an object value" code fix that handles when you drop a model into a spot designated for a value [Playground]:

@example(#{"Baz": "Hello"})
model FooBar { Baz : string; }

would turn it into a value

@example(#{Baz: "Hello"})

instead of to an invalid value [Playground]:

@example(#{"Baz": "Hello"})

This would ease migrations to TypeSpec while removing a case where a codefix leaves invalid code after being applied.

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    design:neededA design request has been raised that needs a proposalfeatureNew feature or requestideIssues for VS, VSCode, Monaco, etc.triaged:core

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions