Skip to content

Commit 51fd737

Browse files
fix: Bump version to 0.1.7 in jsr.json and update related imports
1 parent 39685e2 commit 51fd737

8 files changed

Lines changed: 25 additions & 22 deletions

File tree

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@murat/openapi",
33
"exports": "./mod.ts",
4-
"version": "0.1.6",
4+
"version": "0.1.7",
55
"tasks": {
66
"lint": "deno lint",
77
"test": "deno test --allow-all",

jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@murat/openapi",
3-
"version": "0.1.6",
3+
"version": "0.1.7",
44
"license": "MIT",
55
"exports": "./mod.ts",
66
"imports": {

mod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export * from "./src/Core.types.ts";
22
export * from "./src/Licenses.types.ts";
3-
export * from "./src/Core.ts";
3+
export * from "./src/Core.ts";

src/Core.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ import type {
22
OpenAPICore,
33
OpenAPISecurityRequirement,
44
OpenAPITag,
5-
} from './Core.types.ts';
6-
import { createEndpointBuilder } from './EndpointBuilder.ts';
7-
import { createEndpointPath, type EndpointPath } from './EndpointPath.ts';
8-
import type { AllowedLicenses } from './Licenses.types.ts';
5+
} from "./Core.types.ts";
6+
import { createEndpointBuilder } from "./EndpointBuilder.ts";
7+
import { createEndpointPath, type EndpointPath } from "./EndpointPath.ts";
8+
import type { AllowedLicenses } from "./Licenses.types.ts";
99

1010
class OpenAPI {
1111
private raw: OpenAPICore;
1212

1313
constructor() {
1414
this.raw = {
15-
openapi: '3.1.0',
15+
openapi: "3.1.0",
1616
info: {
17-
title: 'OpenAPI 3.1.0',
18-
version: '1.0.0',
17+
title: "OpenAPI 3.1.0",
18+
version: "1.0.0",
1919
},
2020
};
2121
}
@@ -63,19 +63,19 @@ class OpenAPI {
6363
}
6464

6565
setLicenseName(name: string): this {
66-
this.raw.info.license = this.raw.info.license || { name: '' };
66+
this.raw.info.license = this.raw.info.license || { name: "" };
6767
this.raw.info.license.name = name;
6868
return this;
6969
}
7070

7171
setLicenseUrl(url: string): this {
72-
this.raw.info.license = this.raw.info.license || { name: '' };
72+
this.raw.info.license = this.raw.info.license || { name: "" };
7373
this.raw.info.license.url = url;
7474
return this;
7575
}
7676

7777
setLicenseIdentifier(identifier: AllowedLicenses): this {
78-
this.raw.info.license = this.raw.info.license || { name: '' };
78+
this.raw.info.license = this.raw.info.license || { name: "" };
7979
this.raw.info.license.identifier = identifier;
8080
return this;
8181
}
@@ -104,7 +104,7 @@ class OpenAPI {
104104
}
105105

106106
setSecurity(scheme: {
107-
type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
107+
type: "apiKey" | "http" | "oauth2" | "openIdConnect";
108108
name: string;
109109
scopes?: string[];
110110
}): this {
@@ -153,7 +153,7 @@ class OpenAPI {
153153
}
154154
}
155155

156-
export { OpenAPI, createEndpointPath, createEndpointBuilder };
156+
export { createEndpointBuilder, createEndpointPath, OpenAPI };
157157

158158
// const openAPI = new OpenAPI();
159159

src/Core.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,10 +771,10 @@ type OpenAPITag = {
771771
};
772772

773773
export type {
774-
OpenAPICore,
775774
OpenAPICallback,
776775
OpenAPIComponents,
777776
OpenAPIContact,
777+
OpenAPICore,
778778
OpenAPIDataTypes,
779779
OpenAPIDiscriminator,
780780
OpenAPIEncoding,

src/EndpointBuilder.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import type {
2-
OpenAPIMethodsLowercase,
32
OpenAPIOperation,
43
OpenAPIParameterLocation,
54
} from "./Core.types.ts";
65

76
class EndpointBuilder {
8-
method: OpenAPIMethodsLowercase;
7+
method: string;
98
operation: OpenAPIOperation;
109

11-
constructor(method: OpenAPIMethodsLowercase) {
10+
constructor(method: string) {
1211
this.method = method;
1312
this.operation = {} as OpenAPIOperation;
1413
}
@@ -107,7 +106,7 @@ class EndpointBuilder {
107106
}
108107

109108
function createEndpointBuilder(
110-
method: OpenAPIMethodsLowercase,
109+
method: string,
111110
): EndpointBuilder {
112111
return new EndpointBuilder(method);
113112
}

src/EndpointPath.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ class EndpointPath {
4747
}
4848

4949
addEndpoint(builder: EndpointBuilder): this {
50-
if (this.pathItem[builder.method]) {
50+
if (this.pathItem[builder.method as keyof OpenAPIPathItem]) {
5151
console.warn(
5252
`Endpoint with method ${builder.method} already exists for path ${this.path}, Overwriting it.`,
5353
);
5454
}
5555

56-
this.pathItem[builder.method] = builder.operation;
56+
// deno-lint-ignore no-explicit-any
57+
this.pathItem[builder.method as keyof OpenAPIPathItem] = builder
58+
.operation as any;
5759
return this;
5860
}
5961
}

test/complex_api_test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ Deno.test("Complex API with multiple paths and methods", () => {
6363

6464
// Store paths in variables with type assertions to avoid repeated null checks
6565
const paths = raw.paths!;
66+
// deno-lint-ignore no-explicit-any
6667
const postsPath = paths["/posts"] as any;
68+
// deno-lint-ignore no-explicit-any
6769
const postIdPath = paths["/posts/{postId}"] as any;
6870

6971
// Test methods on first path

0 commit comments

Comments
 (0)