Problem
DocSpec.Spec.Schema (lines 400–516) contains 6 delegated functions that all forward to DocSpec.JSON:
encode_without_defaults/1 → DocSpec.JSON.to_encodable/1
to_camel_case/1 → DocSpec.JSON.to_camel_case/1
to_snake_case/1 → DocSpec.JSON.to_snake_case/1
decode_json/1 → DocSpec.JSON.decode/1
decode_json!/1 → DocSpec.JSON.decode!/1
decode_keys/1 → DocSpec.JSON.from_decoded/1
The comment says these are "kept for backwards compatibility."
Issues
- Duplicates
DocSpec.JSON's documented public API
- Adds maintenance burden (two sets of
@doc + @spec to keep in sync)
- Confuses library consumers about which module to use for JSON operations
Schema is not where users would look for JSON encoding/decoding functions
Proposal
- Add
@deprecated "Use DocSpec.JSON.to_encodable/1 instead" (etc.) to each delegate
- Document migration in CHANGELOG
- Remove in the next major version
Files
lib/docspec/spec/schema.ex (lines 400–516)
Problem
DocSpec.Spec.Schema(lines 400–516) contains 6 delegated functions that all forward toDocSpec.JSON:encode_without_defaults/1→DocSpec.JSON.to_encodable/1to_camel_case/1→DocSpec.JSON.to_camel_case/1to_snake_case/1→DocSpec.JSON.to_snake_case/1decode_json/1→DocSpec.JSON.decode/1decode_json!/1→DocSpec.JSON.decode!/1decode_keys/1→DocSpec.JSON.from_decoded/1The comment says these are "kept for backwards compatibility."
Issues
DocSpec.JSON's documented public API@doc+@specto keep in sync)Schemais not where users would look for JSON encoding/decoding functionsProposal
@deprecated "Use DocSpec.JSON.to_encodable/1 instead"(etc.) to each delegateFiles
lib/docspec/spec/schema.ex(lines 400–516)