⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
fix: address OpenAPI review feedback
Tine2b076778106
diff --git a/apps/api/src/index.ts b/apps/api/src/index.tsindex 91c07e53d..530c2f79e 100644--- a/apps/api/src/index.ts+++ b/apps/api/src/index.ts@@ -252,7 +252,7 @@ export function createApp() {200: {description: "The requested asset binary stream",content: {- "*/*": { schema: resolver(v.any()) },+ "*/*": { schema: { type: "string", format: "binary" } },},},},diff --git a/apps/api/src/search/index.ts b/apps/api/src/search/index.tsindex 58f70025d..8d64afceb 100644--- a/apps/api/src/search/index.ts+++ b/apps/api/src/search/index.ts@@ -67,10 +67,12 @@ const search = new Hono<{v.pipe(v.string(),v.transform(Number),+ v.number(),+ v.integer("Limit must be an integer"),v.minValue(1, "Limit must be at least 1"),v.maxValue(50, "Limit must not exceed 50"),),- "20",+ 20,),userEmail: v.optional(v.pipe(v.string(), v.email())),}),@@ -88,7 +90,7 @@ const search = new Hono<{type,workspaceId,projectId,- limit: typeof limit === "string" ? Number(limit) : limit,+ limit,});return c.json(results);diff --git a/apps/api/src/task/index.ts b/apps/api/src/task/index.tsindex 831e63b1d..dbeffb3db 100644--- a/apps/api/src/task/index.ts+++ b/apps/api/src/task/index.ts@@ -523,7 +523,7 @@ const task = new Hono<{},}),validator("param", v.object({ id: v.string() })),- validator("json", v.object({ userId: v.string() })),+ validator("json", v.object({ userId: v.nullable(v.string()) })),workspaceAccess.fromTask(),requireWorkspacePermission({ task: ["assign"] }),async (c) => {diff --git a/apps/api/src/utils/openapi-spec.ts b/apps/api/src/utils/openapi-spec.tsindex 9a753efee..e3320b5dc 100644--- a/apps/api/src/utils/openapi-spec.ts+++ b/apps/api/src/utils/openapi-spec.ts@@ -97,6 +97,47 @@ export const normalizeOrganizationAuthOperations = (summaryObjectParts,)}`.trim();operation.tags = ["Organization Management"];++ if (path === "/auth/organization/get-invitation" && method === "get") {+ const parameters = operation.parameters;+ if (Array.isArray(parameters)) {+ const idParameter = parameters.find(+ (parameter) =>+ isPlainObject(parameter) &&+ parameter.name === "id" &&+ parameter.in === "query",+ );+ if (isPlainObject(idParameter)) {+ idParameter.required = true;+ }+ }+ }++ if (path === "/auth/organization/update-team" && method === "post") {+ const requestBody = operation.requestBody;+ if (isPlainObject(requestBody)) {+ const content = requestBody.content;+ const jsonContent = isPlainObject(content)+ ? content["application/json"]+ : undefined;+ const schema = isPlainObject(jsonContent)+ ? jsonContent.schema+ : undefined;+ const properties = isPlainObject(schema)+ ? schema.properties+ : undefined;+ const data = isPlainObject(properties) ? properties.data : undefined;+ const dataProperties = isPlainObject(data)+ ? data.properties+ : undefined;+ const id = isPlainObject(dataProperties)+ ? dataProperties.id+ : undefined;+ if (isPlainObject(id)) {+ delete id.default;+ }+ }+ }}}diff --git a/apps/docs/openapi.json b/apps/docs/openapi.jsonindex 5097094d0..f070001a4 100644--- a/apps/docs/openapi.json+++ b/apps/docs/openapi.json@@ -171,7 +171,8 @@"content": {"*/*": {"schema": {- "type": "object"+ "type": "string",+ "format": "binary"}}}@@ -2189,7 +2190,8 @@"type": "object","properties": {"userId": {- "type": "string"+ "type": "string",+ "nullable": true}},"required": [@@ -6581,10 +6583,10 @@"in": "query","name": "limit","schema": {- "type": "string",+ "type": "integer","minimum": 1,"maximum": 50,- "default": "20"+ "default": 20}},{@@ -11549,7 +11551,8 @@"schema": {"type": "string","description": "The ID of the invitation to get"- }+ },+ "required": true}],"responses": {@@ -13663,7 +13666,6 @@"properties": {"id": {"type": "string",- "default": "M6mcvJzStshERyUqBha2hU6KW5mudtWJ","nullable": true},"name": {diff --git a/tests/api/utils/openapi-spec.test.ts b/tests/api/utils/openapi-spec.test.tsindex af2df5cc4..df9b491a3 100644--- a/tests/api/utils/openapi-spec.test.ts+++ b/tests/api/utils/openapi-spec.test.ts@@ -100,6 +100,67 @@ describe("openapi spec helpers", () => {expect(schemaNames).toEqual(["MemberList", "Member"]);});+ it("normalizes organization invitation and team schemas", () => {+ const normalized = normalizeOrganizationAuthOperations({+ paths: {+ "/organization/get-invitation": {+ get: {+ parameters: [+ { name: "id", in: "query", schema: { type: "string" } },+ ],+ },+ },+ "/organization/update-team": {+ post: {+ requestBody: {+ content: {+ "application/json": {+ schema: {+ properties: {+ data: {+ properties: {+ id: {+ type: "string",+ default: "generated-team-id",+ nullable: true,+ },+ },+ },+ },+ },+ },+ },+ },+ },+ },+ },+ });+ const paths = normalized.paths as Record<+ string,+ Record<string, Record<string, unknown>>+ >;+ const invitationParameters = paths["/auth/organization/get-invitation"].get+ .parameters as Record<string, unknown>[];+ expect(invitationParameters[0]?.required).toBe(true);++ const requestBody = paths["/auth/organization/update-team"].post+ .requestBody as {+ content: {+ "application/json": {+ schema: {+ properties: {+ data: { properties: { id: Record<string, unknown> } };+ };+ };+ };+ };+ };+ expect(+ requestBody.content["application/json"].schema.properties.data.properties+ .id,+ ).toEqual({ type: "string", nullable: true });+ });+it("merges hono and auth specs", () => {const merged = mergeOpenApiSpecs({