Unexpected "id", "type", "name" in extraction files

Open
#340 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
57/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
azure, typescript
Domain
backend, cli

Research direction

Start with the extraction and artifact-format documentation referenced in the issue, then trace how extraction serializes APIM resources to JSON. Check whether the CLI supports excluding managed fields or whether extraction always writes them. Done means the behavior is explained or the JSON output can omit id, type, and name as requested.

Written by the indexing model from the issue text.

Description

type:question
Question

From here: https://github.com/Azure/apiops-cli/blob/main/docs/reference/artifact-format.md

APIM-managed fields (like id, type, name) are not stored — they're reconstructed at publish time

Can you explain why the JSON files created by extraction have "id", "type", "name" in them? "type" and "name" are unnecessary, and "id" is environment specific. An example from a named value file namedValueInformation.json:

{ "id": "/subscriptions/d0d2d3bd-2eca-495a-b5a3-c510c051b66a/resourceGroups/rg-ourservices-dev-001/providers/Microsoft.ApiManagement/service/apim001/namedValues/My-Centre-Subscription-Rate-Limit-Calls", "type": "Microsoft.ApiManagement/service/namedValues", "name": "My-Centre-Subscription-Rate-Limit-Calls", "properties": { "displayName": "My-Centre-Subscription-Rate-Limit-Calls", "value": "10", "tags": [ "my-centre-tag" ], "secret": false } }

I would expect id, name and type to be absent like so:

{ "properties": { "displayName": "My-Centre-Subscription-Rate-Limit-Calls", "value": "10", "tags": [ "my-centre-tag" ], "secret": false } }

Am I missing something, is there a way I can exclude these properties? They're everywhere, I don't want the noise nor do I want to have to include them in our override files.

Thanks!

Context

Using v1.0.5

PS> apiops extract --resource-group rg-ourservices-dev-001 `
>> --service-name apim001 `
>> --output .\extract `
>> --subscription-id d0d2d3bd-2eca-495a-b5a3-c510c051b66a `
>> --format json
Dominant language
TypeScript
Stars
44
Forks
14
PR merge metrics
No merged PRs in 30d

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

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/apiops-cli

All issues in Azure/apiops-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.