Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
Move Openapi schema to infra.
Browse files Browse the repository at this point in the history
  • Loading branch information
patroza committed May 16, 2021
1 parent 1283084 commit 6eb5083
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,19 @@ import {
referenced,
StringSchema,
} from "@atlas-ts/plutus"
import * as T from "@effect-ts/core/Effect"
import * as O from "@effect-ts/core/Option"
import {
constrainedStringIdentifier,
EmailFromStringIdentifier,
EmailIdentifier,
PhoneNumberFromStringIdentifier,
PhoneNumberIdentifier,
boolIdentifier,
nullableIdentifier,
UUIDFromStringIdentifier,
hasContinuation,
intersectIdentifier,
SchemaContinuationSymbol,
unionIdentifier,
arrayIdentifier,
chunkIdentifier,
dateIdentifier,
Expand All @@ -28,25 +38,11 @@ import {
positiveIntIdentifier,
propertiesIdentifier,
stringIdentifier,
} from "@effect-ts/schema"
} from "@effect-ts-demo/core/ext/Schema"
import * as T from "@effect-ts/core/Effect"
import * as O from "@effect-ts/core/Option"

import {
constrainedStringIdentifier,
EmailFromStringIdentifier,
EmailIdentifier,
PhoneNumberFromStringIdentifier,
PhoneNumberIdentifier,
} from "../../_api"
import * as S from "../_schema"
import {
boolIdentifier,
nullableIdentifier,
UUIDFromStringIdentifier,
hasContinuation,
intersectIdentifier,
SchemaContinuationSymbol,
unionIdentifier,
} from "../_schema"

export type Gen<T> = T.UIO<JSONSchema>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { HasContinuation, Schema, SchemaAny, SchemaContinuationSymbol } from "../vendor"
import {
AnyError,
HasContinuation,
Schema,
SchemaAny,
SchemaContinuationSymbol,
} from "@effect-ts-demo/core/ext/Schema"

import type { JSONSchema } from "@atlas-ts/plutus"

export * from "../"
export * from "@effect-ts-demo/core/ext/Schema"

export class SchemaOpenApi<
ParserInput,
ParserError,
ParserError extends AnyError,
ParsedShape,
ConstructorInput,
ConstructorError,
ConstructorError extends AnyError,
Encoded,
Api
>
Expand Down Expand Up @@ -44,7 +50,14 @@ export class SchemaOpenApi<
}

export function openapi<ParsedShape>(f: () => JSONSchema) {
return <ParserInput, ParserError, ConstructorInput, ConstructorError, Encoded, Api>(
return <
ParserInput,
ParserError extends AnyError,
ConstructorInput,
ConstructorError extends AnyError,
Encoded,
Api
>(
self: Schema<
ParserInput,
ParserError,
Expand All @@ -67,10 +80,10 @@ export function openapi<ParsedShape>(f: () => JSONSchema) {

export function openapi_<
ParserInput,
ParserError,
ParserError extends AnyError,
ParsedShape,
ConstructorInput,
ConstructorError,
ConstructorError extends AnyError,
Encoded,
Api
>(
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/infra/context/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import * as Sy from "@effect-ts/core/Sync"

export function makeCodec<
ParserInput,
ParserError, // extends S.AnyError,
ParserError extends S.AnyError,
ParsedShape extends { id: Id },
ConstructorInput,
ConstructorError,
ConstructorError extends S.AnyError,
Encoded,
Api,
Id
Expand Down
3 changes: 2 additions & 1 deletion packages/infra/express/schema/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import {
} from "@atlas-ts/plutus"
import * as EO from "@effect-ts-demo/core/ext/EffectOption"
import * as S from "@effect-ts-demo/core/ext/Schema"
import * as OpenApi from "@effect-ts-demo/core/ext/Schema/Openapi"
import { pipe } from "@effect-ts/core"
import * as A from "@effect-ts/core/Collections/Immutable/Array"
import * as T from "@effect-ts/core/Effect"
import * as O from "@effect-ts/core/Option"
import * as Ex from "@effect-ts/express"

import * as OpenApi from "../../Openapi"

import {
makeRequestHandler,
Middleware,
Expand Down

0 comments on commit 6eb5083

Please sign in to comment.