Cannot passing json string ttext with space

Open
#73 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
azure, powershell
Domain
cli, cloud

Research direction

Start by reproducing the az apic api create command in PowerShell with --custom-properties, comparing SampleWork with Sample Work. Trace the argument parsing for this option; done means JSON string values containing spaces are accepted without the shorthand syntax error.

Written by the indexing model from the issue text.

Description

Bug Untriaged

Description

I am trying to register an api with --custom-properties. It works fine until I add space in json string for .--custom-properties.

Reproduction steps

Steps to reproduce the behavior:
using Powershell the below command is wont work if there is space between Sample Work. It works if the space is removed:

az apic api create --resource-group "rg-azintegration" --service-name "my-int-apic-npe"
--api-id "newrestproductsystemwithallmetadata2" --title "2 My rest product system all metadata"
--type "rest" --description "My product rest api metadata"
--summary "short product api summary metadata" `
--custom-properties '{"TargetSystem":Sun,"Authentication":["SAML"],"IntergationId":"OnlyString1234","Entity":"Sample work"}'

However, if a set the Entity in --custom-properties to "Sample Work", adding space between Sample and Work it fails with the below error.

az : ERROR: Failed to parse '--custom-properties' argument: Shorthand Syntax Error: Please wrap whitespace
character in single quotes:
At line:4 char:1

  • az apic api create --resource-group "rt-syd-npe-arg-icc-devtest-azint ...
  •   + CategoryInfo          : NotSpecified: (ERROR: Failed t... single quotes::String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
    
      {TargetSystem:Sun,Authentication:[SAML],IntergationId:OnlyString1234,Entity:Sample 
    
  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

If I remove the space between the string SampleWork it works fine.

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Dominant language
PowerShell
Stars
45
Forks
21
Avg merge
21m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/api-center

All issues in Azure/api-center

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.