Skip to content

Commit

Permalink
Merge pull request #60 from calcom/fix/add-servers-openapi-spec
Browse files Browse the repository at this point in the history
  • Loading branch information
agustif committed Apr 26, 2022
2 parents 944e9b1 + fa30b52 commit bceeeeb
Show file tree
Hide file tree
Showing 29 changed files with 52 additions and 29 deletions.
2 changes: 1 addition & 1 deletion pages/api/attendees/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

/**
* @swagger
* /v1/attendees/{id}:
* /attendees/{id}:
* get:
* summary: Get an attendee by ID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/attendees/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { schemaAttendeeBodyParams, schemaAttendeePublic, withValidAttendee } fro

/**
* @swagger
* /v1/attendees:
* /attendees:
* get:
* summary: Get all attendees
* security:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/availabilities/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

/**
* @swagger
* /v1/availabilities/{id}:
* /availabilities/{id}:
* get:
* summary: Get an availability by ID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/availabilities/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { schemaAvailabilityBodyParams, schemaAvailabilityPublic } from "@lib/val

/**
* @swagger
* /v1/availabilities:
* /availabilities:
* get:
* summary: Get all availabilities
* security:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/booking-references/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {

/**
* @swagger
* /v1/booking-references/{id}:
* /booking-references/{id}:
* get:
* summary: Get a daily event reference by ID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/booking-references/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

/**
* @swagger
* /v1/booking-references:
* /booking-references:
* get:
* summary: Get all booking references
* security:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/bookings/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

/**
* @swagger
* /v1/bookings/{id}:
* /bookings/{id}:
* get:
* summary: Get a booking by ID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/bookings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { schemaBookingBodyParams, schemaBookingPublic, withValidBooking } from "

/**
* @swagger
* /v1/bookings:
* /bookings:
* get:
* summary: Get all bookings
* security:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/daily-event-references/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

/**
* @swagger
* /v1/daily-event-references/{id}:
* /daily-event-references/{id}:
* get:
* summary: Get a daily event reference by ID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/daily-event-references/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

/**
* @swagger
* /v1/daily-event-references:
* /daily-event-references:
* get:
* summary: Get all daily event reference
* security:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/destination-calendars/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

/**
* @swagger
* /v1/destination-calendars/{id}:
* /destination-calendars/{id}:
* get:
* summary: Get a destination calendar by ID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/destination-calendars/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

/**
* @swagger
* /v1/destination-calendars:
* /destination-calendars:
* get:
* summary: Get all destination calendars
* security:
Expand Down
25 changes: 24 additions & 1 deletion pages/api/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ import { withSwagger } from "next-swagger-doc";
const swaggerHandler = withSwagger({
definition: {
openapi: "3.0.0",
servers: [
{ url: "https://api.cal.com/v1" },
{ url: "https://api.cal.dev/v1" },
{ url: "http://localhost:3002/v1" },
],
externalDocs: {
url: "https://docs.cal.com",
description: "Find more info at our main docs: https://docs.cal.com/",
},
info: {
title: `${pjson.name}: ${pjson.description}`,
version: pjson.version,
Expand All @@ -15,7 +24,21 @@ const swaggerHandler = withSwagger({
},
},
apiFolder: "pages/api",
tags: ["users", "teams", "memeberships"],
tags: [
"users",
"teams",
"memeberships",
"selected-calendars",
"schedules",
"payments",
"event-types",
"event-type-custom-inputs",
"destination-calendars",
"daily-event-references",
"booking-references",
"availabilities",
"attendees",
],
sort: true,
});
export default swaggerHandler();
2 changes: 1 addition & 1 deletion pages/api/event-type-custom-inputs/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

/**
* @swagger
* /v1/event-type-custom-inputs/{id}:
* /event-type-custom-inputs/{id}:
* get:
* summary: Get a eventTypeCustomInput by ID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/event-type-custom-inputs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

/**
* @swagger
* /v1/event-type-custom-inputs:
* /event-type-custom-inputs:
* get:
* summary: Get all eventTypeCustomInputs
* security:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/event-types/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

/**
* @swagger
* /v1/event-types/{id}:
* /event-types/{id}:
* get:
* summary: Get a eventType by ID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/event-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { schemaEventTypeBodyParams, schemaEventTypePublic } from "@lib/validatio

/**
* @swagger
* /v1/event-types:
* /event-types:
* get:
* summary: Get all event types
* security:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/memberships/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { schemaQueryIdAsString, withValidQueryIdString } from "@lib/validations/

/**
* @swagger
* /v1/memberships/{userId}_{teamId}:
* /memberships/{userId}_{teamId}:
* get:
* summary: Get a membership by userID and teamID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/memberships/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { schemaMembershipBodyParams, schemaMembershipPublic } from "@lib/validat

/**
* @swagger
* /v1/memberships:
* /memberships:
* get:
* summary: Get all memberships
* security:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/payments/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

/**
* @swagger
* /v1/payments/{id}:
* /payments/{id}:
* get:
* summary: Get one of your own payments by ID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/payments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { schemaPaymentPublic } from "@lib/validations/payment";

/**
* @swagger
* /v1/payments:
* /payments:
* get:
* summary: Get all payments
* security:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/schedules/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

/**
* @swagger
* /v1/schedules/{id}:
* /schedules/{id}:
* get:
* summary: Get a schedule by ID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/schedules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { schemaScheduleBodyParams, schemaSchedulePublic, withValidSchedule } fro

/**
* @swagger
* /v1/schedules:
* /schedules:
* get:
* summary: Get all schedules
* security:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/selected-calendars/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { schemaQueryIdAsString, withValidQueryIdString } from "@lib/validations/

/**
* @swagger
* /v1/selected-calendars/{userId}_{integration}_{externalId}:
* /selected-calendars/{userId}_{integration}_{externalId}:
* get:
* summary: Get a selected-calendar by userID and teamID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/selected-calendars/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {

/**
* @swagger
* /v1/selected-calendars:
* /selected-calendars:
* get:
* summary: Get all selected calendars
* security:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/teams/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { schemaTeamBodyParams, schemaTeamPublic } from "@lib/validations/team";

/**
* @swagger
* /v1/teams/{id}:
* /teams/{id}:
* get:
* summary: Get a team by ID
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/teams/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { schemaTeamBodyParams, schemaTeamPublic, withValidTeam } from "@lib/vali

/**
* @swagger
* /v1/teams:
* /teams:
* get:
* summary: Get all teams
* security:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/users/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { schemaUserEditBodyParams, schemaUserReadPublic, withValidUser } from "@

/**
* @swagger
* /v1/users/{id}:
* /users/{id}:
* get:
* summary: Get a user by ID, returns your user if regular user.
* parameters:
Expand Down
2 changes: 1 addition & 1 deletion pages/api/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { schemaUserReadPublic } from "@lib/validations/user";

/**
* @swagger
* /v1/users:
* /users:
* get:
* summary: Get all users (admin only), returns your user if regular user.
* security:
Expand Down

0 comments on commit bceeeeb

Please sign in to comment.