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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export OpenAPIV3 types #600

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

un1024
Copy link

@un1024 un1024 commented May 11, 2021

apiSpec arg of OpenApiValidator.middleware() type is also OpenAPIV3.Document, but it is not exported type.
I'd like to use OpenAPIV3 document type on my application code as follows.
Would it be possible? Excuse me if there are any problems. 馃檱

// file1.ts
export const path1: OpenAPIV3.PathsObject = {
  "/v1/some1": {
    get: {
        // something
    }
  }
}
// file2.ts
export const path2: OpenAPIV3.PathsObject = {
  "/v1/some2": {
    post: {
        // something
    }
  }
}
// schema.ts
import { path1 } from "./file1";
import { path2 } from "./file2";

export const schema: OpenAPIV3.Document = {
  openapi: "3.0.3",
  info: {
    title: "some API",
    version: "1.0.0",
  },
  paths: deepmerge.all<OpenAPIV3.PathsObject>([path1, path2])
};

@rek
Copy link

rek commented Aug 6, 2021

as a workaround i have just been doing:

import { OpenAPIV3 } from 'openapi-core';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants