Skip to content

✨ Extend the code generator for Collections by extending their functionality to follow links#76

Merged
aorabdel merged 24 commits intomainfrom
client_generator
Apr 1, 2025
Merged

✨ Extend the code generator for Collections by extending their functionality to follow links#76
aorabdel merged 24 commits intomainfrom
client_generator

Conversation

@aorabdel
Copy link
Copy Markdown
Contributor

Description

This change extends the generator for endpoints with a Get method that returns a Collection (x-collection or SimpleCollection schemas), and defines two methods for following links for each endpoint, one in the APIService struct and one in the APIRequest struct.

The generation is based on the same methods that executes a Get request, the original Execute method is parsed into an AST, copied and modified to be able to follow links, by adding a link argument, and modifying the path to follow that argument.

Test Coverage

The test added only tests generation for the FollowLinks functions as the testing for x-redact in Collections is already part of existing tests.

  • This change is covered by existing or additional automated tests.
  • Manual testing has been performed (and evidence provided) as automated testing was not feasible.
  • Additional tests are not required for this change (e.g. documentation update).

Comment thread generator/codegen/linkfollower_extensions.go Outdated
Comment thread generator/codegen/linkfollower_extensions.go Outdated
Comment thread generator/codegen/linkfollower_extensions.go Outdated
Comment thread generator/codegen/linkfollower_extensions.go Outdated
Comment thread generator/codegen/linkfollower_extensions.go
Comment thread generator/codegen/linkfollower_extensions.go Outdated
Comment thread extensions/extension_link_followers.gen.go
Comment thread generator/codegen/linkfollower_extensions.go Outdated
Comment thread generator/codegen/common.go Outdated
Comment thread generator/codegen/linkfollower_extensions.go Outdated
Comment thread generator/codegen/linkfollower_extensions.go Outdated
Comment thread generator/codegen/linkfollower_extensions.go Outdated
Comment thread generator/codegen/linkfollower_extensions.go Outdated
Comment thread generator/codegen/linkfollower_extensions.go Outdated
@aorabdel aorabdel force-pushed the client_generator branch 2 times, most recently from 0e6f528 to 5f59ae1 Compare March 28, 2025 18:25
aorabdel and others added 12 commits March 28, 2025 18:29
Bumps golang from 1.23.5 to 1.24.1.

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=golang&package-manager=docker&previous-version=1.23.5&new-version=1.24.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)

</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Monty Bot <monty-bot@arm.com>
Co-authored-by: Adrien CABARBAYE <adrien.cabarbaye@arm.com>
Co-authored-by: acabarbaye <acabarbaye@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we need to stop the CI from doing this on every commit

Comment thread generator/codegen/linkfollower_extensions.go
Copy link
Copy Markdown
Contributor

@joshjennings98 joshjennings98 left a comment

Choose a reason for hiding this comment

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

This looks better, thanks for addressing my comments 👍

@aorabdel aorabdel merged commit eb10785 into main Apr 1, 2025
@aorabdel aorabdel deleted the client_generator branch April 1, 2025 08:41
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.

4 participants