Last active
August 28, 2022 19:29
-
-
Save darrelmiller/551465458ada8521fbbe309a989e4afb to your computer and use it in GitHub Desktop.
CADL for Kevin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "@cadl-lang/rest"; | |
import "@cadl-lang/openapi3"; | |
using Cadl.Http; | |
@serviceTitle("ConferenceService") | |
namespace ConferenceApi { | |
alias Error = NotFound | InternalServerError; | |
@route("conferences") | |
interface ConferenceResource { | |
@route("conferences/{id}") | |
@get Retrieve(...RetrieveConference): ConferenceRetrieved | Error; | |
@post Create(...CreateConference): ConferenceCreated | Error; | |
} | |
model RetrieveConference { | |
@path | |
id: string; | |
} | |
model CreateConference { | |
@body | |
conference: ConferenceSchema; | |
} | |
model ConferenceRetrieved extends ConferenceSchema { | |
@statusCode statusCode: 200; | |
id: string; | |
} | |
model ConferenceCreated { | |
@statusCode statusCode: 201; | |
} | |
model NotFound { | |
@statusCode statusCode: 404; | |
} | |
model InternalServerError { | |
@statusCode statusCode: 500; | |
} | |
model ConferenceSchema { | |
address: Address; | |
} | |
model Address { | |
street: string; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's the outputted OpenAPI