Skip to content

decodingFallback effects cannot use context requirements #5603

@tatemz

Description

@tatemz

What is the problem this feature would solve?

Right now decodingFallback effects cannot use R context requirements, limiting how fallback values can be computed. (e.g. from an API Client)

export type DecodingFallbackAnnotation<A> = (issue: ParseIssue) => Effect<A, ParseIssue>

What is the feature you are proposing to solve the problem?

export type DecodingFallbackAnnotation<A, R> = (issue: ParseIssue) => Effect<A, ParseIssue, R>
Schema.annotations({
  decodingFallback: () => Effect.gen(function* () {
    const fooApi = yield* FooApiTag
    return yield* fooApi.getFoo()
  })
})

What alternatives have you considered?

Parameterized dependency injection

const makeAnnotation = (fooApi) => Schema.annotations({
  decodingFallback: () => fooApi.getFoo()
})

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