Skip to content

Deprecate backwards-compatibility delegates in DocSpec.Spec.Schema #23

Description

@StephanMeijer

Problem

DocSpec.Spec.Schema (lines 400–516) contains 6 delegated functions that all forward to DocSpec.JSON:

  • encode_without_defaults/1DocSpec.JSON.to_encodable/1
  • to_camel_case/1DocSpec.JSON.to_camel_case/1
  • to_snake_case/1DocSpec.JSON.to_snake_case/1
  • decode_json/1DocSpec.JSON.decode/1
  • decode_json!/1DocSpec.JSON.decode!/1
  • decode_keys/1DocSpec.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

  1. Add @deprecated "Use DocSpec.JSON.to_encodable/1 instead" (etc.) to each delegate
  2. Document migration in CHANGELOG
  3. Remove in the next major version

Files

  • lib/docspec/spec/schema.ex (lines 400–516)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions