Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpApi annotation with additional schemas #3939

Merged
merged 4 commits into from
Nov 15, 2024

Conversation

KhraksMamtsov
Copy link
Contributor

@KhraksMamtsov KhraksMamtsov commented Nov 13, 2024

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Added the ability to annotate the HttpApi with additional schemas
Which will be taken into account when generating components.schemas section of OpenApi schema

import { Schema } from "effect"
import { HttpApi } from "@effect/platform"

HttpApi.empty.annotate(
  HttpApi.AdditionalSchemas,
  [
    Schema.Struct({
      contentType: Schema.String,
      length: Schema.Int
    }).annotations({
      identifier: "ComponentsSchema"
    })
  ]
)
/**
 {
  "openapi": "3.0.3",
  ...
  "components": {
    "schemas": {
      "ComponentsSchema": {...},
      ...
  },
  ...
  }
 */

Related

  • Related Issue #
  • Closes #

Copy link

changeset-bot bot commented Nov 13, 2024

🦋 Changeset detected

Latest commit: 87e2f4f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 28 packages
Name Type
@effect/platform Patch
@effect/cli Patch
@effect/cluster-node Patch
@effect/cluster-workflow Patch
@effect/cluster Patch
@effect/experimental Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/rpc-http Patch
@effect/rpc Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-node Patch
@effect/sql Patch
@effect/ai Patch
@effect/ai-openai Patch
@effect/cluster-browser Patch
@effect/sql-drizzle Patch
@effect/sql-kysely Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

packages/platform/src/HttpApi.ts Outdated Show resolved Hide resolved
packages/platform/src/HttpApi.ts Outdated Show resolved Hide resolved
@tim-smart tim-smart merged commit 3cc6514 into Effect-TS:main Nov 15, 2024
8 checks passed
@github-actions github-actions bot mentioned this pull request Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants