Routebase for ASP.NET Core
Routebase.AspNetCore is a NuGet package for ASP.NET Core apps. It writes the app's OpenAPI document as JSON and as YAML on every build, and it serves an API reference for that document from the app itself. Linked to your Routebase workspace, every CI build also pushes the document into its spec and shows the API rating and the style-guide report in the build log.
The package works with Microsoft.AspNetCore.OpenApi, Swashbuckle and NSwag. It is MIT-licensed and adds no runtime dependency to your app.
Installing the package
The package works with .NET 10 and .NET 11 and needs an app that already describes its endpoints with one of the three generators.
Add the package:
dotnet add package Routebase.AspNetCoreRun
dotnet build. The documents appear inobj/, for exampleobj/MyApi.jsonandobj/MyApi.yaml.
The package brings Microsoft.Extensions.ApiDescription.Server, which is the build-time generation from Microsoft, in the version of your target framework. That package consists of build files and adds nothing to the output of your app. If your project already references it, your version stays in place.
Writing the document on build
The build starts your app without its runtime configuration to read the endpoints, then writes the JSON file and a YAML copy next to it. The YAML file holds the same document key for key and in the same order. Swashbuckle and NSwag switch this generation off by default, and the package switches it back on.
To keep the files in the project folder, set the directory in the project file:
<PropertyGroup>
<OpenApiDocumentsDirectory>$(MSBuildProjectDirectory)/openapi</OpenApiDocumentsDirectory>
</PropertyGroup>
The build runs Program.cs in the Production environment. A registration that needs a connection string or a secret fails there, so skip it while the document is generated:
using Routebase.AspNetCore;
if (!RoutebaseOpenApi.IsGeneratingDocument)
{
builder.Services.AddSingleton(new BlobServiceClient(builder.Configuration["Storage:ConnectionString"]));
}
Describing responses
The document describes only what the code declares. A minimal API handler that returns IResult through Results.Json(...) or Results.Ok(...) gives the generator no type. On its own, such a response appears as a bare 200 without a body, and the 404 that the handler also returns is missing.
The package reads these handlers when it compiles your app. When every return path is a Results call with a fixed status code and a named type, the build adds the responses to the endpoint. The document then describes them without a code change:
// Documented as 200 with Product and 404 with ApiError.
app.MapGet("/products/{id:int}", (int id, DataStore db) =>
db.Products.FirstOrDefault(p => p.Id == id) is { } product
? Results.Ok(product)
: Results.NotFound(new ApiError("NOT_FOUND", "Product not found.")));
The build reads these Results methods, in lambdas and in methods that you pass as the handler:
Ok,Json,CreatedandAcceptedBadRequest,NotFound,Conflict,UnprocessableEntityandInternalServerErrorNoContent,UnauthorizedandStatusCodewith a fixed numberProblemandValidationProblem
A path can also return the call of a helper of your own, such as Auth.Unauthorized(). The build then reads the paths of that helper.
An endpoint stays as it is in these cases:
- One path is something else, such as an anonymous type,
object, text or HTML, a status code from a variable, or a helper whose source is not in the project. - The body is a
filetype, which generated code in another file cannot name. - Two paths return different bodies for the same status code.
- The endpoint already declares responses with
Produces,WithMetadataor[ProducesResponseType]. - Microsoft's Request Delegate Generator runs, which Native AOT, trimming and
EnableRequestDelegateGeneratorswitch on. Only one generator can take over aMapcall.
To turn this off, set RoutebaseInferResponses to false in the project file.
Fixing responses in the editor
An endpoint that the build cannot describe shows the suggestion RBA0001 in your IDE. It offers up to three fixes:
- Use TypedResults turns the
Resultscalls intoTypedResultscalls. For several result kinds, it also declares a return type such asResults<Ok<Product>, NotFound<ApiError>>. - Declare responses with Produces adds one
Producescall per status code. - Extract a record for the anonymous response replaces an anonymous object such as
new { status = "ok" }with a record named after the route, such asHealthResponse. The record keeps the member names as written, so the JSON stays the same, and the build then describes the response.
A controller action of an [ApiController] that returns IActionResult or ActionResult without [ProducesResponseType] shows RBA0002. Its fix adds one [ProducesResponseType] per status code, which it reads from the Ok(...), NotFound() and similar calls of the action.
Both stay out of the build log by default. To see them in every build, raise them in .editorconfig:
[*.cs]
dotnet_diagnostic.RBA0001.severity = warning
dotnet_diagnostic.RBA0002.severity = warning
Declaring responses yourself
TypedResults describe themselves, so their responses carry the schema without the build reading the handler:
using Microsoft.AspNetCore.Http.HttpResults;
app.MapGet("/products", (DataStore db) => TypedResults.Ok(db.Products))
.WithTags("Products")
.WithSummary("List products");
app.MapGet("/products/{id:int}", Results<Ok<Product>, NotFound<ApiError>> (int id, DataStore db) =>
db.Products.FirstOrDefault(p => p.Id == id) is { } product
? TypedResults.Ok(product)
: TypedResults.NotFound(new ApiError("NOT_FOUND", "Product not found.")));
A handler that keeps returning IResult declares its responses with Produces:
app.MapGet("/orders", GetOrders)
.Produces<List<Order>>()
.Produces<ApiError>(StatusCodes.Status401Unauthorized);
WithTags becomes the folder of the endpoint in Routebase when RoutebaseFoldersFromTags is true. WithSummary and WithDescription become the texts of the endpoint. Controllers declare the same with ActionResult<T> and [ProducesResponseType].
Schemas take their descriptions from XML doc comments, including the <param> tags of a positional record, once the project writes its documentation file:
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
When GET operations describe no response body, the build warns with RB1003 and names how many and which ones.
Other methods do not count, because a success without a body is a correct answer for many of them.
Serving the API reference
Map the page in Program.cs:
using Routebase.AspNetCore;
app.MapRoutebaseApiReference();
The page is served at /routebase in a light and a dark theme. It lists the endpoints by tag with a search, shows code samples for each one, and has a request playground that calls your API from the browser. It shows the document written at build time, which the build copies next to your app. So it works in production and needs no runtime document route.
All endpoints are on one page below the overview. Scroll through them or jump to one from the navigation, which marks the endpoint in view. Copy as Markdown above each endpoint copies its parameters, request body and responses as Markdown, for example for a chat with an AI assistant. The overview at the start of the page names the version, the servers and the authentication of your API and lists every operation. From there you can download the document as JSON, as YAML or as a Postman collection. The page builds the YAML and the collection in your browser, so nothing is sent anywhere. The collection has one folder per tag, a baseUrl variable and one variable per credential, such as bearerToken. Every schema of the document has its own page under Schemas in the navigation, with its properties, nested objects and enum values. The properties switch between a list and a table, as on the endpoint pages. Type names in the endpoints link to their schema, and the Schemas section in the navigation opens and closes.
These options change what the page shows and what it allows:
| Option | Effect |
|---|---|
DocumentUrl |
Shows a document your app serves at runtime, such as /swagger/v1/swagger.json |
DocumentName |
Shows a named build-time document, such as internal |
Title |
Sets the browser tab title |
ShowSchemas |
false leaves out the Schemas section, the schema pages and the links to them |
Toolbar |
When the Routebase menu shows, as a value of RoutebaseToolbar: Localhost (default), Always or Never |
AppUrl |
The Routebase app the toolbar opens, https://app.routebase.dev by default |
Cors |
Whether the Routebase app may call your API from the browser while your app runs in Development, as a value of RoutebaseCors: Development (default) or Never |
app.MapRoutebaseApiReference("/docs", options =>
{
options.DocumentName = "internal";
options.Title = "Orders API";
});
Without a path, the page stays at /routebase:
app.MapRoutebaseApiReference(options => options.Title = "Orders API");
Where the page is reachable is your decision. Map it inside if (app.Environment.IsDevelopment()) to keep it local, or protect it like any other endpoint with .RequireAuthorization().
While your app runs in the Development environment, mapping the page also lets the Routebase app at AppUrl call your API from the browser. So a test run you start in the Routebase web app reaches your app on localhost. The page answers CORS for that one origin, names the requested headers such as Authorization explicitly and never allows credentials. Your own CORS policy keeps working next to it. Map the page before UseHttpsRedirection, because the browser drops a preflight that gets redirected. Mapped on a route group, the page leaves CORS to your app, and options.Cors = RoutebaseCors.Never does the same.
With a strict Content Security Policy, the page needs style-src-attr 'unsafe-inline', because code samples are colored through inline styles. Scripts, styles and fonts come from the page itself, so 'self' covers them.
Linking a build to Routebase
A push requires an API key with specs:write and specs:delete, because it also removes what the document no longer contains. Looking up a spec by name and the local preview require specs:read.
Connecting from the app
Connect build… shows every step with the IDs of your project and your spec filled in. Reading the steps needs no extra permission. Creating the key requires org:manage-security and a verified email address.
- Open the context menu of the spec and click Connect build…. The sheet also opens from the Build connection card on the spec overview.
- Pick the tab of your target framework in step 01 and run the two commands in your project folder.
- Copy the lines of step 02 into your project file. They carry the project ID and the spec ID, and for a US organization the region.
- Pick the tab of your generator in step 03 and copy the lines into
Program.cs. They set the document's title to the spec's name and map the API reference for development. The push works without this step. - Click Create build key in step 04 and copy the key. Routebase shows it once. The key reads, writes and deletes specs in this project only, and it does not expire.
- Store the key in your CI as step 05 describes, and add the build step shown there.
Copy as one prompt for your coding agent puts steps 01 to 03 and the CI step into one text that a coding agent applies to your repository. The key is not part of that text.
Without org:manage-security the sheet shows a note instead of the button. Ask an org admin to open Connect build… on the spec and to create the key there.
Connect build… also sits in the context menu of a project. Start there for a spec that does not exist yet, or when one build writes several documents. The sheet then begins with two tabs:
- New spec creates an empty spec from the name you enter, which requires specs:write. The steps carry the ID of the new spec, and the first push of your build fills it.
- Existing specs lists the specs of the project. Select the specs your build updates and give each one a document name, which is the name your app registers the OpenAPI document under. An empty name stands for the default document. Step 02 then holds one
RoutebaseSpecLinkline per spec, and step 03 registers each document with its title.
After the first push, the Build connection card names the time, the version and the API key of the last push.
Linking by hand
Create an API key under Settings → API Keys with these permissions.
Copy the project ID and the spec name or ID from Routebase. Copy project ID sits in the context menu of a project, and Copy spec ID in the context menu of a spec.
Link the documents in the project file, one
RoutebaseSpecLinkper document:<PropertyGroup> <RoutebaseProject>3f2b6c1e-0000-0000-0000-000000000000</RoutebaseProject> </PropertyGroup> <ItemGroup> <RoutebaseSpecLink Include="Orders API" /> <RoutebaseSpecLink Include="Internal API" Document="internal" /> </ItemGroup>Give the CI job the key as the environment variable
ROUTEBASE_API_KEY. The package reads the key only from there, so it never ends up in a committed file.- run: dotnet build env: ROUTEBASE_API_KEY: ${{ secrets.ROUTEBASE_API_KEY }}
Every CI build of the default branch now pushes the document into the draft of its spec. It is the same push as routebase spec push of the Routebase CLI. The push matches endpoints by path and method, so test cases and mock rules linked in Routebase keep their links. The first push into an empty spec also starts its setup in Routebase, as far as the key's permissions allow. The setup is a mock server with rules, an environment that points at the mock and smoke tests, and the build reports it once with RB1109.
A key that holds only the spec permissions, such as the build key from Connect build…, starts none of these steps, and RB1109 then names the permissions it lacks. The spec overview then shows the Spec setup card. Click Set up now there, and Routebase runs the setup in the background with your permissions. Starting it requires the permission of every step that is still open, which is mock-server:manage for the mock server and tests:write for the smoke tests. Dismiss closes the card without a setup and requires specs:write. Mock Server and Contract Testing describe what the setup creates.
A spec can keep several major versions side by side, such as a 3.x line that still gets fixes next to 4.x. Each line then has its own draft, and a push without a line stops with RB1103 because the spec has more than one draft. Set Line on the link to the major version, and the push goes into the draft of that line. When the line has no draft, the push first creates the next patch of the line's latest release as a copy and names it in the build output.
<ItemGroup>
<RoutebaseSpecLink Include="Orders API" Line="4" />
<RoutebaseSpecLink Include="Orders API" Document="v3" Line="3" />
</ItemGroup>
A line without any version stops with RB1103 as well, because a new major version starts in Routebase.
RoutebasePush decides what a build does:
| Value | CI, default branch | CI, other branch, pull request or tag | On a developer machine |
|---|---|---|---|
Auto (default) |
Pushes | Previews if a key is set | Previews if a key is set and the document changed |
Always |
Pushes | Pushes | Pushes |
Never |
Nothing | Nothing | Nothing |
A preview writes nothing. It warns with RB1106 when a push would change the spec, so a pull request shows its effect on the spec before you merge it. The warning names the breaking changes that a push would need a decision for.
A push happens once per document and target. When the document is the same as at the last push from this build folder, the build pushes nothing and says so in the log. A CI job that runs dotnet build, dotnet test and dotnet publish therefore pushes once, and a fresh checkout pushes again.
A build counts as CI when CI is true or one of GITHUB_ACTIONS, TF_BUILD, GITLAB_CI, JENKINS_URL, BUILDKITE, CIRCLECI, BITBUCKET_BUILD_NUMBER, APPVEYOR or TRAVIS is set. The build reads the branch, pull requests and tags of these CIs:
- GitHub Actions, GitLab and Buildkite, which also name the default branch
- Azure DevOps, Jenkins, CircleCI, Bitbucket Pipelines, AppVeyor and Travis CI, where
mainandmastercount as the default branch
GitHub Actions names the default branch in the event payload, GitLab in CI_DEFAULT_BRANCH and Buildkite in BUILDKITE_PIPELINE_DEFAULT_BRANCH.
To name the default branch yourself, set it in the project file:
<PropertyGroup>
<RoutebasePushBranch>develop</RoutebasePushBranch>
</PropertyGroup>
A CI that does not say which branch it builds pushes nothing and warns with RB1110. In that case, set RoutebasePush to Always in the job that builds your default branch.
The spec's name and the document's info.title are the same field. Keep them equal, because every push reports RB1104 while they differ. Rename the spec in Routebase to the title, or give the document the spec's name:
builder.Services.AddOpenApi(options => options.AddDocumentTransformer((document, context, cancellationToken) =>
{
document.Info.Title = "Orders API";
return Task.CompletedTask;
}));
With Swashbuckle the title is the Title of SwaggerDoc, and with NSwag it is the Title of AddOpenApiDocument.
A spec linked by its ID appears with that ID in the build messages, so a link by name reads better in the log. Link it by ID when the name may change.
A linked build pushes only the documents its links name. When the build writes a document that no RoutebaseSpecLink names, for example after you add a module with its own document, it warns with RB1108 and shows the line to add. To keep a document out of Routebase on purpose, add one item per document with its name, or with the file name without .json for the default document:
<ItemGroup>
<RoutebaseIgnoreDocument Include="internal" />
</ItemGroup>
Deciding on breaking changes
A push updates the draft by itself as long as nothing breaks. When the document has a breaking change against the draft, such as a removed endpoint, Routebase refuses the push and writes nothing. The build then fails with RB1111. The error names the breaking changes and links to the page in Routebase where you decide.
You have three ways to go on:
- Open the link and click Accept and update the draft. Routebase writes the document into the draft, and the next run of the build passes.
- Change the code so that it matches the contract again. Click Reject, the code has to change on the linked page to close the open decision.
- Run the build once with
-p:RoutebasePushOnBreaking=Accept. That push takes the breaking changes into the draft.
Deciding in Routebase requires specs:write and specs:delete, like the push itself.
The linked page also offers Open a branch with a merge request. The push then waits on a branch of the draft, and merging its merge request takes it into the draft. Opening the branch requires specs:branch as well.
With Auto, only a build of the default branch pushes. A pull request therefore warns with RB1106, and the decision comes up on the first build of the default branch after the merge.
RoutebasePushOnBreaking sets what a push with breaking changes does:
| Value | Effect |
|---|---|
Error (default) |
Routebase refuses the push, and the build fails with RB1111 |
Warning |
Routebase refuses the push, and the build goes on with RB1111 as a warning |
Accept |
The push takes the breaking changes into the draft |
Pass Accept to a single run and keep it out of the project file, so that every breaking change stays a decision. This GitHub Actions workflow offers it as an input of a manual run on the default branch:
on:
push:
branches: [main]
workflow_dispatch:
inputs:
on-breaking:
description: What a push with breaking changes does in this run
type: choice
default: Error
options:
- Error
- Accept
- run: dotnet build -p:RoutebasePushOnBreaking=${{ inputs.on-breaking || 'Error' }}
env:
ROUTEBASE_API_KEY: ${{ secrets.ROUTEBASE_API_KEY }}
A value on the command line wins over the project file. If your project file sets Warning, write Warning in place of Error in the step.
Two cases need more than Accept:
- The spec's Breaking changes from code setting is Ask, decide in Routebase only. A build cannot accept then, so it fails with
RB1111and you decide on the linked page. - Someone also edited a value in Routebase that the document owns. The run then needs
-p:RoutebasePushOverwrite=trueas well. On the linked page you tick Replace the values edited in Routebase instead.
A preview pushes nothing, so Accept has no effect on a pull request or on a developer machine with Auto.
Reading the rating and the lint report
After a push, the build fetches the API rating and the style-guide report of the draft it just pushed and writes them as warnings. They show up in the build log and in the error list of your IDE. The summary RB1201 is a warning only when your organization's target is missed, and otherwise it is a message in the build log.
| Code | Content |
|---|---|
RB1201 |
Grade, score, your organization's target and a link to the report |
RB1202 |
Rating checks that failed or passed partly, the costliest first |
RB1203 |
Style-guide rules with errors or warnings, one line per rule with its first place and how many more |
Each list stops at ten entries and says how many more the report holds. Custom rules appear in RB1203 by their name. The rating is part of the Pro plan, and reading it requires a key with specs:read. A preview shows neither report, because the draft changes only with a push. Set RoutebaseRating to false to skip both reports.
Starting without a workspace
Writing the document and serving the reference need no Routebase account. Two places lead into Routebase with your own document:
- Open in Routebase, the menu in the header of the API reference, has the actions Rate and lint, Mock server, Publish docs and Smoke tests, plus Keep in sync on every build. An action opens one Routebase tab and hands it the document. Once you are signed in, the tab shows where the document goes and what the update changes there. The target is the spec of the same name, any other spec you pick or a new project, and one click runs the action. Routebase remembers the spec you used, so the next action goes there again. When that spec keeps several major versions, the tab asks for the Version line the document belongs to and preselects the major of the document's
info.version. The project file lines then carry that line, so your build pushes into the same one. For a summary or description you edited in Routebase, you choose whether it stays or the document replaces it. Other values you edited there are replaced only after you tick the box that names them. Without an account, a signup page for this path comes first and leads back to the same step. The result stays in that tab next to the three steps that keep the spec in sync. These are the project file lines, a button that creates the API key for your build and the CI step that passes it on. The reference shows the result next to the menu, such as In Routebase · Score C 64 · Mock running, and it says Changed since the last update once a build has changed the document. Each entry of the menu then carries its result, which is the mock URL to copy or a link to the rating, the docs portal, the test suite or its run. - The menu shows only while the page runs on your own machine, which means
localhost,127.0.0.1,[::1]or a*.localhosthost. A published reference does not show it, andToolbarchanges that in both directions. - The first local build of a project without
RoutebaseSpecLinkshowsRB1107once, with a link into the same steps. There you choose the document your build wrote, because a build opens no browser tab that could hand it over. It never shows in CI or in a container build, andRoutebaseHintset tofalseturns it off.
The menu hands the document only to the Routebase tab it opened. Routebase keeps it in your browser until you are signed in, so it never reaches a server without your account.
Running the smoke tests against your app
On a reference that runs on localhost, 127.0.0.1 or [::1], Smoke tests also runs the smoke suite against your app right away. The Routebase tab points an environment named Local at the address of the reference and sends the requests from your browser, so they reach your app on your machine. When your app runs under a path base, such as UsePathBase("/api"), the base URL of Local includes that path. Before the first run, the tab asks whether it may send test requests to that address, and Chrome asks for local network access. The reference then shows the result next to the menu, such as In Routebase · Tests 11/12 passed, and the Smoke tests entry links to the run.
A smoke test of an endpoint with a path parameter calls a variable such as {{orderId}}. Where your document gives the parameter an example or a default value, Local gets that value before the run, unless the variable already has one. The tab then names the tests that still call a variable without a value. Add values opens the test runner on Local, where you add the variables and enter their values. Creating or changing Local and its variables requires projects:write, and the run requires tests:execute. Testing a Local API describes the approval and what each browser allows.
Settings
| Property | Default | Effect |
|---|---|---|
RoutebaseGenerateOpenApiOnBuild |
true |
Writes the document on every build |
RoutebaseOpenApiYaml |
true |
Writes a YAML copy next to every JSON document |
RoutebaseCopyOpenApiDocuments |
true |
Copies the JSON documents into the build and publish output for the reference |
RoutebaseProject |
ID of the Routebase project the linked specs belong to | |
RoutebasePush |
Auto |
Auto, Always or Never |
RoutebasePushBranch |
The branch whose CI builds push with Auto, if the detected default branch is not the right one |
|
RoutebasePushOverwrite |
false |
Lets the document win over values edited in Routebase since the last push |
RoutebaseFoldersFromTags |
false |
Puts new endpoints into the folder of their first tag |
RoutebasePushFailOnError |
false |
Fails the build when the push fails |
RoutebasePushOnBreaking |
Error |
Error, Warning or Accept for a push with breaking changes against the draft |
RoutebaseRating |
true |
Shows the rating and the style-guide report after a push |
RoutebaseInferResponses |
true |
Adds the responses of handlers that return IResult, read from their Results calls |
RoutebaseResponseHint |
true |
Warns with RB1003 when GET operations describe no response body |
RoutebaseHint |
true |
Shows RB1107 once in an unlinked local build |
RoutebaseBaseUrl |
https://api.routebase.dev |
Address of the Routebase API, also read from the environment variable ROUTEBASE_BASE_URL |
RoutebaseRegion |
us for an organization in the US region, also read from the environment variable ROUTEBASE_REGION |
|
OpenApiDocumentsDirectory |
obj/ |
Folder of the written documents, a property of Microsoft.Extensions.ApiDescription.Server |
| Item | Effect |
|---|---|
RoutebaseSpecLink |
Links a document to a spec, by the spec's name or ID, with Document for a named document and Line for the major version line to push into |
RoutebaseIgnoreDocument |
Keeps one document out of the push without RB1108, by its name or, for the default document, its file name without .json |
Build messages
The RB codes are warnings, with three exceptions:
- A push failure is an error with
RoutebasePushFailOnError. RB1111is an error unlessRoutebasePushOnBreakingisWarning.RB1201is a message when the target is met.
A build with -warnaserror or MSBuildTreatWarningsAsErrors turns the warnings into errors. To keep them as warnings in such a build, list them in the project file:
<PropertyGroup>
<MSBuildWarningsNotAsErrors>$(MSBuildWarningsNotAsErrors);RB1001;RB1002;RB1003;RB1101;RB1102;RB1103;RB1104;RB1105;RB1106;RB1107;RB1108;RB1109;RB1110;RB1111;RB1201;RB1202;RB1203;RB1204</MSBuildWarningsNotAsErrors>
</PropertyGroup>
| Code | Meaning |
|---|---|
RB1001 |
The build files of Microsoft.Extensions.ApiDescription.Server did not reach the project, so no document is written |
RB1002 |
A document could not be read as JSON, or its YAML copy could not be written, so no YAML was written |
RB1003 |
GET operations describe no response body, most likely because their handlers return IResult without a declared type |
RB1101 |
A push was due, but ROUTEBASE_API_KEY is not set |
RB1102 |
The push was refused, because values the document owns were changed in Routebase |
RB1103 |
The push failed, because the key was refused, the project or spec was not found, the document was rejected, Routebase was not reachable or the answer did not come from the Routebase API. The code also covers a preview without an answer within 30 seconds and a push that Routebase refused for another reason, such as a spec without a draft |
RB1104 |
Routebase pushed the document and reported a warning about it |
RB1105 |
The link settings are incomplete or name a spec or document that does not exist |
RB1106 |
A preview of what a push would change, with the counts of added, changed, removed and breaking items and the breaking changes that would need a decision |
RB1107 |
How to link an unlinked project, once per project |
RB1108 |
A linked build wrote a document that no RoutebaseSpecLink pushes and no RoutebaseIgnoreDocument keeps out |
RB1109 |
The first push into an empty spec. The text says which setup steps Routebase started and which it skipped for a missing permission |
RB1110 |
A CI build that does not say which branch it builds, so nothing was pushed |
RB1111 |
Routebase refused the push, because the document has breaking changes against the draft |
RB1201 to RB1203 |
Rating and style-guide report of the pushed draft |
RB1204 |
No rating or report, because of the plan, the key's permissions or the connection |
Code analysis
These show in your IDE as suggestions. Set dotnet_diagnostic.<ID>.severity in .editorconfig to warning, error or none to change them.
| ID | Meaning |
|---|---|
RBA0001 |
A minimal API endpoint returns IResult without declared responses, and the build cannot add them. Fixes are Use TypedResults, Declare responses with Produces and Extract a record for the anonymous response |
RBA0002 |
An [ApiController] action returns IActionResult or ActionResult without [ProducesResponseType]. The fix is Declare responses with ProducesResponseType |
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
No document in obj/ and RB1001 |
A reference keeps the build files of Microsoft.Extensions.ApiDescription.Server out of the project |
Remove ExcludeAssets="build" from that reference |
The build fails with error MSB3073 for the command dotnet-getdocument.dll, after an exception from Program.cs |
Program.cs needs configuration the build does not have |
Skip that registration with RoutebaseOpenApi.IsGeneratingDocument |
RB1102 on every push |
Someone edited a value in Routebase that the document owns | Change it in the code, or set RoutebasePushOverwrite to true. An edited summary or description can stay instead when you keep it in Routebase, in the update there or with Keep text edited in Routebase in the spec settings |
RB1111 on the default branch |
The document has breaking changes against the draft | Decide on the linked page, change the code, or run once with -p:RoutebasePushOnBreaking=Accept |
RB1109 reads "No setup started" |
The key holds only the spec permissions, like the build key from Connect build… | Open the spec overview and click Set up now on the Spec setup card. The warning comes once |
RB1104 on every push |
The document title differs from the spec name | Make both the same |
Responses show 200 without a body |
The handler returns IResult, and the build cannot read one of its paths |
Apply a fix of RBA0001 in your IDE, return TypedResults or add Produces<T>() |
RB1204 after a push |
The plan has no rating, or the key lacks specs:read | Check the plan and the key's permissions |