google-api-php-client-services icon indicating copy to clipboard operation
google-api-php-client-services copied to clipboard

feat: Add the apiVersion protected property to the generated resources when applicable

Open Hectorhammett opened this issue 1 year ago • 5 comments

Add the protected apiVersion property to the generated resource classes when the discovery document contains the apiVersion field inside the resource fields.

Hectorhammett avatar Apr 22 '24 20:04 Hectorhammett

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot https://conventionalcommits.org/

Same thing with this PR, we need to either manually update the goldens to include an API with apiversion (recommended), or we need to add a different specific test for it.

Correct me if I'm wrong, but we are using the discovery-artifact-manager repo as our golden, that's how I tested the generated code. Do we want to make a PR against that repo?

Hectorhammett avatar Apr 23 '24 08:04 Hectorhammett

Correct me if I'm wrong, but we are using the discovery-artifact-manager repo as our golden

No, we use the JSON here: https://github.com/googleapis/google-api-php-client-services/tree/main/generator/tests/testdata/golden_discovery

bshaffer avatar Apr 29 '24 19:04 bshaffer

Correct me if I'm wrong, but we are using the discovery-artifact-manager repo as our golden

No, we use the JSON here: https://github.com/googleapis/google-api-php-client-services/tree/main/generator/tests/testdata/golden_discovery

I added a file to tests/testdata/versioned_sample_discovery.json here: https://github.com/googleapis/google-api-php-client-services/pull/4966/files#diff-8b1ea50f148cf373178d6ee36e0bc1f6f5645e0e74048166d18ab27023d1e054

And I am using it in the test here: https://github.com/googleapis/google-api-php-client-services/pull/4966/files#diff-10ee932e5fe7b3b57f6fed477c8f9e616dfb1f0cfb9dbed246dbfa8dc3ca8cb7R561

Hectorhammett avatar Apr 29 '24 19:04 Hectorhammett

+@parthea for visibility. Would love you to take a glance at this to make sure it looks good!

bshaffer avatar Apr 30 '24 00:04 bshaffer