feat(companies): add retrieve/2, deprecate get/2#99
Open
sgerrand wants to merge 3 commits into
Open
Conversation
Normalises Humaans.Companies onto the standard CRUD macro by adding :retrieve to the generated actions. The custom get/2 now delegates to retrieve/2 and is marked @deprecated, preserving backwards compatibility for existing callers.
There was a problem hiding this comment.
Pull request overview
Normalizes Humaans.Companies to the standard Humaans.Resource CRUD macro by enabling generated retrieve/2, while keeping get/2 as a deprecated backwards-compatible alias.
Changes:
- Add
:retrievetoHumaans.Companies’suse Humaans.Resourceactions list to generateretrieve/2. - Replace the hand-rolled
get/2implementation with a deprecated delegation toretrieve/2. - Update tests to cover
retrieve/2and add a backwards-compatibility check forget/2.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/humaans/companies.ex | Enables macro-generated retrieve/2 and deprecates get/2 to delegate to it. |
| test/humaans/companies_test.exs | Updates retrieval tests to call retrieve/2 and adds a get/2 backwards-compatibility test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Call the deprecated `Humaans.Companies.get/2` via `apply/3` so the compile-time deprecation warning isn't emitted under `mix test --warnings-as-errors`, while still asserting the alias works.
Extract the `apply/3` call into a `result` binding and add a `credo:disable-for-next-line` directive so `mix credo --strict` passes while keeping the indirect call needed to suppress the deprecation warning.
Coverage Report for CI Build 25331418957Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage remained the same at 100.0%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💁 These changes normalise
Humaans.Companiesonto the standard CRUD macro by adding:retrieveto the generated actions list. The customget/2now delegates toretrieve/2and is marked@deprecated.Summary
:retrievetoHumaans.Companies'suse Humaans.Resourceactions list — the macro now generatesretrieve/2, removing the hand-rolled implementationget/2as a deprecated alias that delegates toretrieve/2for backwards compatibilityretrieve/1describe block toretrieve/2and add a small test assertingget/2still worksTest plan
mix test test/humaans/companies_test.exspasses (including the new deprecated-alias test)mix testfull suite still passesmix credocleanHumaans.Companies.get/2