You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"description": "Rapid development of self-documenting APIs",
5
+
"folders": [
6
+
"generated-doc"
7
+
],
8
+
"rules": [
9
+
"When defining Tapir endpoints, always start with the base `endpoint` value and chain methods to build input/output specifications.",
10
+
"Import `sttp.tapir.*` to bring all necessary Tapir functionality into scope for endpoint definitions.",
11
+
"Use `PublicEndpoint[I, E, O, R]` type alias for endpoints without security inputs instead of the full `Endpoint[Unit, I, E, O, R]` type.",
12
+
"Always provide both success and error outputs for endpoints, with error outputs defined using `.errorOut()` methods.",
13
+
"For JSON endpoints, add the appropriate JSON library dependency (circe, play-json, etc.) and import the corresponding package like `sttp.tapir.json.circe.*`.",
14
+
"Use `jsonBody[T]` for JSON request/response bodies, ensuring both a JSON codec (Encoder/Decoder) and Schema[T] are in scope.",
15
+
"Server logic functions should return `F[Either[E, O]]` where F is the effect type, E is the error type, and O is the success type.",
16
+
"When using direct-style, server logic functions should return `Either[E, O]`, and the logic should be provided using .handle methods.",
17
+
"When using `.serverLogicRecoverErrors()`, the error type E must extend Throwable to automatically recover from failed effects.",
18
+
"Status codes default to 200 for success and 400 for errors, but can be customized using status code outputs like `.out(statusCode(StatusCode.Created))`.",
19
+
"Use `.serverSecurityLogic()` followed by `.serverLogic()` for endpoints with authentication, where security logic returns Either[E, User] and main logic uses the User type.",
20
+
"Tapir mappings are always bidirectional, so use `.mapTo[CaseClass]` to automatically map tuples to case classes for both input and output.",
21
+
"Import `sttp.tapir.generic.auto.*` to enable automatic schema derivation for case classes used in endpoint definitions.",
22
+
"Use `infallibleEndpoint` instead of `endpoint` when you want to indicate that no errors can occur in the endpoint.",
23
+
"For file uploads and multipart forms, use specific inputs like `multipartBody` and ensure proper codecs are defined.",
24
+
"When generating OpenAPI documentation, use `SwaggerInterpreter()` or `OpenAPIDocsInterpreter()` to create documentation from endpoint definitions.",
25
+
"Use validation methods like `.validate()` on inputs to add custom validation logic that will be reflected in generated documentation."
Schemas generated by picklers can be customized using annotations, just like with traditional schema derivation (see [here](schemas.html#using-annotations)). Some annotations automatically affect JSON codes:
150
+
Schemas generated by picklers can be customized using annotations, just like with traditional schema derivation (see [here](schemas.md#using-annotations)). Some annotations automatically affect JSON codes:
151
151
152
152
*`@encodedName` determines JSON field name
153
153
*`@default` sets default value if the field is missing in JSON
0 commit comments