Skip to content

Commit

Permalink
#180 Need to update to newer endpoint-spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
stazz committed Feb 14, 2024
1 parent b885244 commit c23ce5f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
4 changes: 2 additions & 2 deletions code/backend-node-io-ts-openapi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ty-ras/backend-node-io-ts-openapi",
"version": "2.4.0",
"version": "2.4.1",
"author": {
"name": "Stanislav Muhametsin",
"email": "[email protected]",
Expand Down Expand Up @@ -46,7 +46,7 @@
"dependencies": {
"@ty-ras/server-node": "^2.3.0",
"@ty-ras/data-backend-io-ts": "^2.0.2",
"@ty-ras/endpoint-spec": "^2.2.0",
"@ty-ras/endpoint-spec": "^2.2.1",
"@ty-ras/metadata-jsonschema-io-ts": "^2.0.1",
"@ty-ras/metadata-openapi": "^2.0.2",
"@ty-ras/state-io-ts": "^2.0.1",
Expand Down
37 changes: 23 additions & 14 deletions code/backend-node-io-ts-openapi/src/md-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ import * as epSpec from "./endpoint-spec";
*/
export function endpointsWithOpenAPI(
builder: epSpec.ApplicationBuilderAny,
creationResult: epSpecBase.EndpointsCreationResult<
epSpec.MetadataProviders,
server.ServerContext,
epSpec.DefaultStateInfo
>,
creationResult: EndpointsCreationResultForOpenAPI,
openAPIPath?: string,
): MutableServerEndpoints;

Expand Down Expand Up @@ -67,10 +63,9 @@ export function endpointsWithOpenAPI<
TDefaultResponseBodyContentType,
TAdditionalDataSpecHKT
>,
creationResult: epSpecBase.EndpointsCreationResult<
epSpec.MetadataProviders,
server.ServerContext,
epSpec.DefaultStateInfo<TAuthenticatedState, TOtherState>
creationResult: EndpointsCreationResultForOpenAPI<
TAuthenticatedState,
TOtherState
>,
responseContentType: TAllResponseBodyContentTypes,
authState: TAuthenticatedState,
Expand Down Expand Up @@ -123,11 +118,7 @@ export function endpointsWithOpenAPI<
{
metadata,
endpoints,
}: epSpecBase.EndpointsCreationResult<
epSpec.MetadataProviders,
server.ServerContext,
epSpec.DefaultStateInfo<TAuthenticatedState, TOtherState>
>,
}: EndpointsCreationResultForOpenAPI<TAuthenticatedState, TOtherState>,
responseContentTypeOrOpenAPIPath?: TAllResponseBodyContentTypes | string,
authState?: TAuthenticatedState,
stateKeys?: TStateKeys,
Expand Down Expand Up @@ -229,6 +220,24 @@ export type MutableServerEndpoints<
>[number]
>;

/**
* Helper type to specify endpoint creation result of {@link endpointsWithOpenAPI}.
*/
export type EndpointsCreationResultForOpenAPI<
TAuthenticatedState extends epSpec.TStateSpecBase = epSpec.TStateSpecBase,
TOtherState extends epSpec.TStateSpecBase = epSpec.TStateSpecBase,
> =
| epSpecBase.EndpointsCreationResult<
epSpec.MetadataProviders,
server.ServerContext,
epSpec.DefaultStateInfo<TAuthenticatedState, TOtherState>
>
| epSpecBase.EndpointsCreationResult<
epSpec.MetadataProviders,
never,
epSpec.DefaultStateInfo<TAuthenticatedState, TOtherState>
>;

/**
* This is the protocol interface for OpenAPI endpoint.
* @see protocol.ProtocolSpecCore
Expand Down
8 changes: 4 additions & 4 deletions code/backend-node-io-ts-openapi/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,10 @@
dependencies:
"@ty-ras/protocol" "^2.0.0"

"@ty-ras/endpoint-spec@^2.2.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@ty-ras/endpoint-spec/-/endpoint-spec-2.2.0.tgz#be4975fe00dec66c10ba86486aba639b5a7c4f88"
integrity sha512-T1LnSduUR/+c7XsQ1YSrxOtjU5mTvCtVyRwgcRFuR+crHz7Y7c6a13ie1MZ/khUnRhPvSsjOda8NRdZKk2KR8A==
"@ty-ras/endpoint-spec@^2.2.1":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@ty-ras/endpoint-spec/-/endpoint-spec-2.2.1.tgz#c74a036648fff48528b0bb27eb438c18b21f6ab0"
integrity sha512-witG7XoTxjArH4YIS551mlIhnWzFnP4EE44fQhXR31kFlRQ8xcgOpExIdSxaDNyVZiUX8lJgJ4r/SqoMGtXhpQ==
dependencies:
"@ty-ras/endpoint" "^2.0.0"
"@ty-ras/metadata" "^2.0.0"
Expand Down

0 comments on commit c23ce5f

Please sign in to comment.