Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use 03-01 spec from azure-rest-api-specs repo to regenerate CLI #19

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

blackchoey
Copy link
Owner

  1. Use 03-01 spec from https://github.com/Azure/azure-rest-api-specs/blob/main/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/apicenter.json to regenerate CLI
  2. I made some patches to the spec for following reasons, related change can be found at patch API Center 2024-03-01 spec to workaround bugs from typespec azure-rest-api-specs#1
    1. There're 2 bugs from typespec that causes some parameters been treated as option, and parameters for update commands being deleted
    2. The 03-01 spec does not have importFromApim API definition

@@ -309,7 +312,7 @@ def content(self):
typ=AAZObjectType,
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
)
_builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
_builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}})
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected change due to the manual workaround of typespec bug

@@ -379,7 +382,7 @@ def _build_schema_on_200_201(cls):
flags={"read_only": True},
)
_schema_on_200_201.properties = AAZObjectType(
flags={"client_flatten": True},
flags={"required": True, "client_flatten": True},
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected change due to the manual workaround of typespec bug

@@ -49,6 +49,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
help="The id of the API.",
required=True,
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]{3,90}$",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected change as the new API spec provides constraints for the value

@@ -184,7 +186,7 @@ def _build_schema_on_200(cls):
flags={"read_only": True},
)
_schema_on_200.value = AAZListType(
flags={"read_only": True},
flags={"required": True, "read_only": True},
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected change because the new API spec marks this property as required

@@ -151,9 +151,10 @@ def _build_schema_on_200(cls):
_schema_on_200 = cls._schema_on_200
_schema_on_200.next_link = AAZStrType(
serialized_name="nextLink",
flags={"read_only": True},
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected change as the API spec marks the property as readonly

@blackchoey blackchoey merged commit 52f66c9 into feature-2wk13 Apr 22, 2024
@blackchoey blackchoey deleted the use-03-01-spec branch April 22, 2024 09:07
blackchoey added a commit that referenced this pull request Apr 29, 2024
* fix: --title --kind --custom-property parameters (#1)

* feat: support yaml file in register command (#3)

* fix: workspace parameter should not be required (#2)

* style: fix lint issues (#6)

* chore: update codeowner for apic-extension (#5)

* feat: revert changes to min cli version (#4)

* feat: resolve comments to CLI experience (#10)

* feat: mark "apic api register" command as preview (#13)

* feat: remove --terms-of-service parameter (#12)

* feat: remove --workspace-name parameter (#11)

* feat: support python 3.8 and 3.9 (#14)

* feat: fix command descriptions (#17)

* tests: add test cases for 'apic service' commands (#16)

* feat: Use 03-01 spec from azure-rest-api-specs repo to regenerate CLI (#19)

* fix: CLI errors (#20)

* fix: import error when run CLI command

* fix: no workspace name error when run import specification command

* feat: mark some parameters as required (#21)

* feat: mark --assignments parameter required for metadata commands

* doc: update sample commands

* feat: mark --source-resource-ids parameter as required for import-from-apim command

* doc: update description for import-from-apim command

* feat: bump version to 1.0.0b5 and update changelog (#18)

* build: fix ci (#22)

* style: fix style warnings

* test:fix test cases

* fix: service update command failure (#28)

* doc: fix command samples (#30)

* doc: update changelog per feedback (#29)

* doc: remove extra spaces in register command help message (#34)

* doc: update api definition and metadata command samples (#36)
blackchoey added a commit that referenced this pull request Apr 29, 2024
* fix: --title --kind --custom-property parameters (#1)

* feat: support yaml file in register command (#3)

* fix: workspace parameter should not be required (#2)

* style: fix lint issues (#6)

* chore: update codeowner for apic-extension (#5)

* feat: revert changes to min cli version (#4)

* feat: resolve comments to CLI experience (#10)

* feat: mark "apic api register" command as preview (#13)

* feat: remove --terms-of-service parameter (#12)

* feat: remove --workspace-name parameter (#11)

* feat: support python 3.8 and 3.9 (#14)

* feat: fix command descriptions (#17)

* tests: add test cases for 'apic service' commands (#16)

* feat: Use 03-01 spec from azure-rest-api-specs repo to regenerate CLI (#19)

* fix: CLI errors (#20)

* fix: import error when run CLI command

* fix: no workspace name error when run import specification command

* feat: mark some parameters as required (#21)

* feat: mark --assignments parameter required for metadata commands

* doc: update sample commands

* feat: mark --source-resource-ids parameter as required for import-from-apim command

* doc: update description for import-from-apim command

* feat: bump version to 1.0.0b5 and update changelog (#18)

* build: fix ci (#22)

* style: fix style warnings

* test:fix test cases

* fix: service update command failure (#28)

* doc: fix command samples (#30)

* doc: update changelog per feedback (#29)

* doc: remove extra spaces in register command help message (#34)

* doc: update api definition and metadata command samples (#36)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants