fix: type note_type and note params - #20
Merged
Merged
Conversation
Note models typed note_type as String and params as Unknown, so callers built notes from raw hashes and a typo in the type went unnoticed. amoCRM documents ten note types and a params shape for each. note_type is now the NoteType enum and params the NoteParams union of per-type models, in requests, responses and the resource signatures. The union has no discriminator of its own, so its variants go from the most specific to Common. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Open
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.
Note models typed
note_typeasStringandparamsasUnknown. The amoCRM docs define ten note types and aparamsshape for each.Amocrm::NoteType: an enum of the ten documented values.Amocrm::NoteParams: a union ofCall,Geolocation,Attachment,MessageCashier(itsstatusis an enum),ServiceMessage,SmsandCommon. The fields come from the documented examples. The union has no discriminator of its own, so the variants go from most specific toCommon; otherwise{status:, text:}would parse asCommon.note_typeandparamsin the ten note request and response models, and in theentity_notesandentity_notes_by_parentresource signatures, in lib, rbi and rbs.paramsstays optional, as it was.create_by_parentand parsing params by their shape.The spec side is Hexlet/amocrm-api#3.
rake lint(rubocop, Sorbet, Steep) andrake test(211 runs, 0 failures) pass.🤖 Generated with Claude Code