Clarification Needed on Using Effect Services and Schema for Application Configuration

Hi,
I have a question about Effect services and Effect schema

Currently I use GenericTag in order to pass down application configuration.

But I don't like that I need to make up two names for Service and Schema, which are describing the same domain entity.

I understand that Schema and Service are for different purposes, first describes structure of objects and another is for injecting dependencies.

In my case I don't find it useful to use Tag instead of Service because it doesn't describe schema for app config but plain structure (without validations like NonEmptyString, NonEmptyArray, etc)

I can't come up with proper question that's why I'll provide a code snippet and I'd appreciate if you say whether this code is fine or there's a better approach.

import { Schema as S } from "@effect/schema"
import { Context } from "effect"

export class ClientCredentialsValue
  extends S.Class<ClientCredentialsValue>("ClientCredentials")({
    clientId: S.NonEmptyString,
    clientSecret: S.NonEmptyString,
    scopes: S.NonEmptyArray(S.NonEmptyString),
    redirectUri: S.NonEmptyString
  }) { }

const ClientCredentials = 
  Context.GenericTag<ClientCredentialsValue>("ClientCredentials") 
Was this page helpful?