Azure / Azure/azure-functions-openapi-extension
Multiline support
- Dominant language
- C#
- Stars
- 388
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
I see no possibility to insert new lines in some fields, e.g. the `Description` field on `OpenApiOperation` attribute. Standard newline character `\n` does not work and is rendered within the yaml file.
```csharp
[OpenApiOperation("getApiTitle", ApiMetaInformationTag, Summary = "Returns the title of this API.", Description = "Use this endpoint to return the title of this API.\nThis is supposed to be displayed on a new line.")]
[OpenApiResponseWithBody(HttpStatusCode.OK, MediaTypeNames.Text.Plain, typeof(string), Description = "OK", Example = typeof(string))]
[Function("getApiTitle")]
public Task InfoTitle([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = Version + InfoRoute + "/title")] HttpRequestData req)
=> req.GenerateOkResponseAsync("Api.Title");
```
```yaml
openapi: 3.0.1
info:
title: My API
description: My API description
version: 1.0.0
servers:
- url: http://localhost:7071/api
paths:
/v1/info/title:
get:
tags:
- api meta information
summary: Returns the title of this API.
description: "Use this endpoint to return the title of this API.\nThis is supposed to be displayed on a new line."
operationId: getApiTitle
responses:
'200':
description: OK
content:
text/plain:
schema:
type: string
```
Contributor guide
Research direction
Start by reproducing the issue with the OpenApiOperation Description example and compare the generated OpenAPI YAML with the expected multiline representation. Trace how the Description value is serialized, then verify that embedded newlines are emitted as actual line breaks rather than literal escape sequences.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100