-
Notifications
You must be signed in to change notification settings - Fork 60
wip: #268 #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
wip: #268 #270
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b119a4e
wip: #268
spaasis ceee0a9
fix: do not compile client twice
sergey-tihon a0221fb
Active pattern
spaasis aad2bfa
an attempt was made
spaasis c203012
clean
spaasis 69bd2d9
hk: cleanup
sergey-tihon ad45d41
fix: add csv output formatter
sergey-tihon 4475a67
Update tests/Swashbuckle.WebApi.Server/Controllers/ReturnTextControll…
sergey-tihon c1074aa
Update tests/SwaggerProvider.ProviderTests/v3/Swashbuckle.ReturnTextC…
sergey-tihon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
23 changes: 23 additions & 0 deletions
23
tests/SwaggerProvider.ProviderTests/v3/Swashbuckle.ReturnTextControllers.Tests.fs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| module Swashbuckle.v3.ReturnTextControllersTests | ||
|
|
||
| open Xunit | ||
| open FsUnitTyped | ||
| open SwaggerProvider | ||
| open System | ||
| open System.Net.Http | ||
|
|
||
| open Swashbuckle.v3.ReturnControllersTests | ||
|
|
||
| let asyncEqual expected actualTask = | ||
| task { | ||
| let! actual = actualTask | ||
| actual |> shouldEqual expected | ||
| } | ||
|
|
||
| [<Fact>] | ||
| let ``Return text/plain GET Test``() = | ||
| api.GetApiReturnPlain() |> asyncEqual "Hello world" | ||
|
|
||
| [<Fact>] | ||
| let ``Return text/csv GET Test``() = | ||
| api.GetApiReturnCsv() |> asyncEqual "Hello,world" | ||
40 changes: 40 additions & 0 deletions
40
tests/Swashbuckle.WebApi.Server/Controllers/ReturnTextControllers.fs
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | ||||||||||||||||||||||||||||||||||
| namespace Swashbuckle.WebApi.Server.Controllers | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| open System.Text | ||||||||||||||||||||||||||||||||||
| open Microsoft.AspNetCore.Mvc | ||||||||||||||||||||||||||||||||||
| open Microsoft.AspNetCore.Mvc.Formatters | ||||||||||||||||||||||||||||||||||
| open Swagger.Internal | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| [<Route("api/[controller]")>] | ||||||||||||||||||||||||||||||||||
| [<ApiController>] | ||||||||||||||||||||||||||||||||||
| type ReturnPlainController() = | ||||||||||||||||||||||||||||||||||
| [<HttpGet; Consumes(MediaTypes.ApplicationJson); Produces("text/plain")>] | ||||||||||||||||||||||||||||||||||
| member this.Get() = | ||||||||||||||||||||||||||||||||||
| "Hello world" |> ActionResult<string> | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| [<Route("api/[controller]")>] | ||||||||||||||||||||||||||||||||||
| [<ApiController>] | ||||||||||||||||||||||||||||||||||
| type ReturnCsvController() = | ||||||||||||||||||||||||||||||||||
| [<HttpGet; Consumes(MediaTypes.ApplicationJson); Produces("text/csv")>] | ||||||||||||||||||||||||||||||||||
sergey-tihon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||
| [<HttpGet; Consumes(MediaTypes.ApplicationJson); Produces("text/plain")>] | |
| member this.Get() = | |
| "Hello world" |> ActionResult<string> | |
| [<Route("api/[controller]")>] | |
| [<ApiController>] | |
| type ReturnCsvController() = | |
| [<HttpGet; Consumes(MediaTypes.ApplicationJson); Produces("text/csv")>] | |
| [<HttpGet; Produces("text/plain")>] | |
| member this.Get() = | |
| "Hello world" |> ActionResult<string> | |
| [<Route("api/[controller]")>] | |
| [<ApiController>] | |
| type ReturnCsvController() = | |
| [<HttpGet; Produces("text/csv")>] |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.