Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
dotnet: [6.0.301]
dotnet: [6.0.400]
runs-on: ${{ matrix.os }}

steps:
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# SwaggerProvider [![NuGet Badge](https://buildstats.info/nuget/SwaggerProvider)](https://www.nuget.org/packages/SwaggerProvider)

[![Join the chat at https://gitter.im/fsprojects/SwaggerProvider](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/fsprojects/SwaggerProvider?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

This SwaggerProvider can be used to access RESTful API generated using [Swagger.io](http://swagger.io)

[![Build Status](https://github.com/fsprojects/SwaggerProvider/workflows/Build%20and%20Test/badge.svg?branch=master)](https://github.com/fsprojects/SwaggerProvider/actions?query=branch%3Amaster)
[![Tested on APIs.guru](https://api.apis.guru/badges/tested_on.svg)](https://APIs.guru)

Documentation: http://fsprojects.github.io/SwaggerProvider/
Documentation: http://fsprojects.github.io/SwaggerProvider/

## Swagger RESTful API Documentation Specification

Expand Down
5 changes: 5 additions & 0 deletions docs/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#### 2.0.0-beta1 - Aug 11, 2022
- F# 6 task{} instead of async{} under thee hood - [#200](https://github.com/fsprojects/SwaggerProvider/pull/200)
- BREAKING: `ProvidedApiClientBase.CallAsync` returns `task` instead of `async`
- BREAKING: `task` CE wrap all exceptions in `AggregateException` (with `OpenApiException` inside)

#### 1.0.2 - Jul 10, 2022
- SharpYaml 2.0.0
- Format code using Fantomas
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.301",
"version": "6.0.400",
"rollForward": "minor"
}
}
2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version 7.1.4
source https://api.nuget.org/v3/index.json
frameworks: net6.0, netstandard2.0

nuget FSharp.Core 4.7.2
nuget FSharp.Core
nuget System.Net.Http
nuget System.Text.Json
nuget FSharp.SystemTextJson
Expand Down
80 changes: 40 additions & 40 deletions paket.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RESTRICTION: || (== net6.0) (== netstandard2.0)
NUGET
remote: https://api.nuget.org/v3/index.json
FSharp.Core (4.7.2)
FSharp.Core (6.0.5)
FSharp.SystemTextJson (0.19.13)
FSharp.Core (>= 4.7)
System.Text.Json (>= 6.0)
Expand Down Expand Up @@ -310,8 +310,8 @@ GITHUB
src/ProvidedTypes.fs (6a9f05e53e334a7d9c55f3be59535323b8ddfaf9)
src/ProvidedTypes.fsi (6a9f05e53e334a7d9c55f3be59535323b8ddfaf9)
remote: fsprojects/FSharp.Data
src/CommonRuntime/NameUtils.fs (6757c40cbd074cb27d227720ef3ad729fe22c2bd)
src/CommonRuntime/Pluralizer.fs (6757c40cbd074cb27d227720ef3ad729fe22c2bd)
src/CommonRuntime/NameUtils.fs (d0a5f47026a395bc0d3e8128512146e9daba69e7)
src/CommonRuntime/Pluralizer.fs (d0a5f47026a395bc0d3e8128512146e9daba69e7)
GROUP Server
RESTRICTION: == net6.0
NUGET
Expand Down Expand Up @@ -350,32 +350,32 @@ NUGET
Microsoft.AspNetCore.Authentication.Abstractions (>= 2.2)
Microsoft.AspNetCore.Http (>= 2.2)
Microsoft.AspNetCore.Http.Extensions (>= 2.2)
Microsoft.AspNetCore.Authorization (6.0.7)
Microsoft.AspNetCore.Metadata (>= 6.0.7)
Microsoft.AspNetCore.Authorization (6.0.8)
Microsoft.AspNetCore.Metadata (>= 6.0.8)
Microsoft.Extensions.Logging.Abstractions (>= 6.0.1)
Microsoft.Extensions.Options (>= 6.0)
Microsoft.AspNetCore.Authorization.Policy (2.2)
Microsoft.AspNetCore.Authentication.Abstractions (>= 2.2)
Microsoft.AspNetCore.Authorization (>= 2.2)
Microsoft.AspNetCore.Connections.Abstractions (6.0.7)
Microsoft.Extensions.Features (>= 6.0.7)
Microsoft.AspNetCore.Connections.Abstractions (6.0.8)
Microsoft.Extensions.Features (>= 6.0.8)
System.IO.Pipelines (>= 6.0.3)
Microsoft.AspNetCore.Cors (2.2)
Microsoft.AspNetCore.Http.Extensions (>= 2.2)
Microsoft.Extensions.Configuration.Abstractions (>= 2.2)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.2)
Microsoft.Extensions.Logging.Abstractions (>= 2.2)
Microsoft.Extensions.Options (>= 2.2)
Microsoft.AspNetCore.Cryptography.Internal (6.0.7)
Microsoft.AspNetCore.DataProtection (6.0.7)
Microsoft.AspNetCore.Cryptography.Internal (>= 6.0.7)
Microsoft.AspNetCore.DataProtection.Abstractions (>= 6.0.7)
Microsoft.AspNetCore.Cryptography.Internal (6.0.8)
Microsoft.AspNetCore.DataProtection (6.0.8)
Microsoft.AspNetCore.Cryptography.Internal (>= 6.0.8)
Microsoft.AspNetCore.DataProtection.Abstractions (>= 6.0.8)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0)
Microsoft.Extensions.Hosting.Abstractions (>= 6.0)
Microsoft.Extensions.Logging.Abstractions (>= 6.0.1)
Microsoft.Extensions.Options (>= 6.0)
System.Security.Cryptography.Xml (>= 6.0)
Microsoft.AspNetCore.DataProtection.Abstractions (6.0.7)
System.Security.Cryptography.Xml (>= 6.0.1)
Microsoft.AspNetCore.DataProtection.Abstractions (6.0.8)
Microsoft.AspNetCore.Diagnostics (2.2)
Microsoft.AspNetCore.Diagnostics.Abstractions (>= 2.2)
Microsoft.AspNetCore.Hosting.Abstractions (>= 2.2)
Expand Down Expand Up @@ -442,15 +442,15 @@ NUGET
Microsoft.AspNetCore.Http.Extensions (>= 2.2)
Microsoft.Extensions.Configuration.Binder (>= 2.2)
Microsoft.Extensions.Options (>= 2.2)
Microsoft.AspNetCore.JsonPatch (6.0.7)
Microsoft.AspNetCore.JsonPatch (6.0.8)
Microsoft.CSharp (>= 4.7)
Newtonsoft.Json (>= 13.0.1)
Microsoft.AspNetCore.Localization (2.2)
Microsoft.AspNetCore.Http.Extensions (>= 2.2)
Microsoft.Extensions.Localization.Abstractions (>= 2.2)
Microsoft.Extensions.Logging.Abstractions (>= 2.2)
Microsoft.Extensions.Options (>= 2.2)
Microsoft.AspNetCore.Metadata (6.0.7)
Microsoft.AspNetCore.Metadata (6.0.8)
Microsoft.AspNetCore.Mvc (2.2)
Microsoft.AspNetCore.Mvc.Analyzers (>= 2.2)
Microsoft.AspNetCore.Mvc.ApiExplorer (>= 2.2)
Expand Down Expand Up @@ -510,9 +510,9 @@ NUGET
Microsoft.CodeAnalysis.Razor (>= 2.2)
Microsoft.Extensions.Caching.Memory (>= 2.2)
Microsoft.Extensions.FileProviders.Composite (>= 2.2)
Microsoft.AspNetCore.Mvc.Razor.Extensions (6.0.7)
Microsoft.AspNetCore.Razor.Language (>= 6.0.7)
Microsoft.CodeAnalysis.Razor (>= 6.0.7)
Microsoft.AspNetCore.Mvc.Razor.Extensions (6.0.8)
Microsoft.AspNetCore.Razor.Language (>= 6.0.8)
Microsoft.CodeAnalysis.Razor (>= 6.0.8)
Microsoft.AspNetCore.Mvc.RazorPages (2.2.5)
Microsoft.AspNetCore.Mvc.Razor (>= 2.2)
Microsoft.AspNetCore.Mvc.TagHelpers (2.2)
Expand All @@ -534,7 +534,7 @@ NUGET
Microsoft.AspNetCore.Razor (2.2)
Microsoft.AspNetCore.Html.Abstractions (>= 2.2)
Microsoft.AspNetCore.Razor.Design (2.2)
Microsoft.AspNetCore.Razor.Language (6.0.7)
Microsoft.AspNetCore.Razor.Language (6.0.8)
Microsoft.AspNetCore.Razor.Runtime (2.2)
Microsoft.AspNetCore.Html.Abstractions (>= 2.2)
Microsoft.AspNetCore.Razor (>= 2.2)
Expand Down Expand Up @@ -610,12 +610,12 @@ NUGET
System.Threading.Tasks.Extensions (>= 4.5.4)
Microsoft.CodeAnalysis.CSharp (4.2)
Microsoft.CodeAnalysis.Common (4.2)
Microsoft.CodeAnalysis.Razor (6.0.7)
Microsoft.AspNetCore.Razor.Language (>= 6.0.7)
Microsoft.CodeAnalysis.Razor (6.0.8)
Microsoft.AspNetCore.Razor.Language (>= 6.0.8)
Microsoft.CodeAnalysis.Common (>= 4.0)
Microsoft.CodeAnalysis.CSharp (>= 4.0)
Microsoft.CSharp (4.7)
Microsoft.Extensions.ApiDescription.Server (6.0.7)
Microsoft.Extensions.ApiDescription.Server (6.0.8)
Microsoft.Extensions.Caching.Abstractions (6.0)
Microsoft.Extensions.Primitives (>= 6.0)
Microsoft.Extensions.Caching.Memory (6.0.1)
Expand Down Expand Up @@ -664,7 +664,7 @@ NUGET
System.Runtime.CompilerServices.Unsafe (>= 6.0)
System.Text.Encodings.Web (>= 6.0)
System.Text.Json (>= 6.0)
Microsoft.Extensions.Features (6.0.7)
Microsoft.Extensions.Features (6.0.8)
Microsoft.Extensions.FileProviders.Abstractions (6.0)
Microsoft.Extensions.Primitives (>= 6.0)
Microsoft.Extensions.FileProviders.Composite (6.0)
Expand All @@ -679,12 +679,12 @@ NUGET
Microsoft.Extensions.Configuration.Abstractions (>= 6.0)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0)
Microsoft.Extensions.FileProviders.Abstractions (>= 6.0)
Microsoft.Extensions.Localization (6.0.7)
Microsoft.Extensions.Localization (6.0.8)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0)
Microsoft.Extensions.Localization.Abstractions (>= 6.0.7)
Microsoft.Extensions.Localization.Abstractions (>= 6.0.8)
Microsoft.Extensions.Logging.Abstractions (>= 6.0.1)
Microsoft.Extensions.Options (>= 6.0)
Microsoft.Extensions.Localization.Abstractions (6.0.7)
Microsoft.Extensions.Localization.Abstractions (6.0.8)
Microsoft.Extensions.Logging (6.0)
Microsoft.Extensions.DependencyInjection (>= 6.0)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0)
Expand Down Expand Up @@ -720,7 +720,7 @@ NUGET
Microsoft.Extensions.Primitives (>= 6.0)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
System.Text.Json (>= 6.0)
Microsoft.Extensions.ObjectPool (6.0.7)
Microsoft.Extensions.ObjectPool (6.0.8)
Microsoft.Extensions.Options (6.0)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0)
Microsoft.Extensions.Primitives (>= 6.0)
Expand All @@ -732,7 +732,7 @@ NUGET
Microsoft.Extensions.Primitives (>= 6.0)
Microsoft.Extensions.Primitives (6.0)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
Microsoft.Extensions.WebEncoders (6.0.7)
Microsoft.Extensions.WebEncoders (6.0.8)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0)
Microsoft.Extensions.Options (>= 6.0)
Microsoft.Net.Http.Headers (2.2.8)
Expand Down Expand Up @@ -770,9 +770,9 @@ NUGET
System.Formats.Asn1 (>= 5.0)
System.Security.Cryptography.Pkcs (6.0.1)
System.Formats.Asn1 (>= 6.0)
System.Security.Cryptography.Xml (6.0)
System.Security.Cryptography.Xml (6.0.1)
System.Security.AccessControl (>= 6.0)
System.Security.Cryptography.Pkcs (>= 6.0)
System.Security.Cryptography.Pkcs (>= 6.0.1)
System.Security.Principal.Windows (5.0)
System.Text.Encoding.CodePages (6.0)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
Expand Down Expand Up @@ -843,24 +843,24 @@ NUGET
Microsoft.Win32.Registry (>= 4.3)
System.Collections.Immutable (>= 5.0)
System.Configuration.ConfigurationManager (>= 4.7)
Microsoft.CodeCoverage (17.2)
Microsoft.CodeCoverage (17.3)
Microsoft.NET.StringTools (1.0)
System.Memory (>= 4.5.4)
System.Runtime.CompilerServices.Unsafe (>= 5.0)
Microsoft.NET.Test.Sdk (17.2)
Microsoft.CodeCoverage (>= 17.2)
Microsoft.TestPlatform.TestHost (>= 17.2)
Microsoft.NET.Test.Sdk (17.3)
Microsoft.CodeCoverage (>= 17.3)
Microsoft.TestPlatform.TestHost (>= 17.3)
Microsoft.NETCore.Platforms (6.0.5)
Microsoft.NETCore.Targets (5.0)
Microsoft.OpenApi (1.3.2) - redirects: force
Microsoft.OpenApi.Readers (1.3.2) - redirects: force
Microsoft.OpenApi (>= 1.3.2)
SharpYaml (>= 1.9.2)
Microsoft.TestPlatform.ObjectModel (17.2)
Microsoft.TestPlatform.ObjectModel (17.3)
NuGet.Frameworks (>= 5.11)
System.Reflection.Metadata (>= 1.6)
Microsoft.TestPlatform.TestHost (17.2)
Microsoft.TestPlatform.ObjectModel (>= 17.2)
Microsoft.TestPlatform.TestHost (17.3)
Microsoft.TestPlatform.ObjectModel (>= 17.3)
Newtonsoft.Json (>= 9.0.1)
Microsoft.Win32.Primitives (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Expand All @@ -872,7 +872,7 @@ NUGET
Microsoft.Win32.SystemEvents (6.0.1)
Mono.Cecil (0.11.4)
Newtonsoft.Json (13.0.1)
NuGet.Frameworks (6.2.1)
NuGet.Frameworks (6.3)
runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3)
Expand Down Expand Up @@ -1285,9 +1285,9 @@ NUGET
System.Security.Cryptography.Primitives (>= 4.3)
System.Text.Encoding (>= 4.3)
System.Threading (>= 4.3)
System.Security.Cryptography.Xml (6.0)
System.Security.Cryptography.Xml (6.0.1)
System.Security.AccessControl (>= 6.0)
System.Security.Cryptography.Pkcs (>= 6.0)
System.Security.Cryptography.Pkcs (>= 6.0.1)
System.Security.Permissions (6.0)
System.Security.AccessControl (>= 6.0)
System.Windows.Extensions (>= 6.0)
Expand Down
8 changes: 4 additions & 4 deletions src/Common/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ open System.Reflection
[<assembly: AssemblyTitleAttribute("SwaggerProvider")>]
[<assembly: AssemblyProductAttribute("SwaggerProvider")>]
[<assembly: AssemblyDescriptionAttribute("F# Type Provider for Swagger & Open API")>]
[<assembly: AssemblyVersionAttribute("1.0.2")>]
[<assembly: AssemblyFileVersionAttribute("1.0.2")>]
[<assembly: AssemblyVersionAttribute("2.0.0")>]
[<assembly: AssemblyFileVersionAttribute("2.0.0")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "SwaggerProvider"
let [<Literal>] AssemblyProduct = "SwaggerProvider"
let [<Literal>] AssemblyDescription = "F# Type Provider for Swagger & Open API"
let [<Literal>] AssemblyVersion = "1.0.2"
let [<Literal>] AssemblyFileVersion = "1.0.2"
let [<Literal>] AssemblyVersion = "2.0.0"
let [<Literal>] AssemblyFileVersion = "2.0.0"
22 changes: 11 additions & 11 deletions src/SwaggerProvider.DesignTime/v2/OperationCompiler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ type OperationCompiler(schema: SwaggerObject, defCompiler: DefinitionCompiler, i
let msg = %httpRequestMessageWithPayload
RuntimeHelpers.fillHeaders msg %heads

async {
let! response = (%this).HttpClient.SendAsync(msg) |> Async.AwaitTask
task {
let! response = (%this).HttpClient.SendAsync(msg)
return response.EnsureSuccessStatusCode().Content
}
@>
Expand All @@ -216,9 +216,9 @@ type OperationCompiler(schema: SwaggerObject, defCompiler: DefinitionCompiler, i
<@
let x = %action

async {
task {
let! response = x
let! content = response.ReadAsStringAsync() |> Async.AwaitTask
let! content = response.ReadAsStringAsync()
return (%this).Deserialize(content, innerReturnType)
}
@>
Expand All @@ -227,22 +227,22 @@ type OperationCompiler(schema: SwaggerObject, defCompiler: DefinitionCompiler, i
<@
let x = %action

async {
task {
let! _ = x
return ()
}
@>

let task t =
<@ Async.StartAsTask(%t) @>
let awaitTask t =
<@ Async.AwaitTask(%t) @>

// if we're an async method, then we can just return the above, coerced to the overallReturnType.
// if we're not async, then run that^ through Async.RunSynchronously before doing the coercion.
match asAsync, retTy with
| true, Some t -> Expr.Coerce(<@ RuntimeHelpers.asyncCast t %responseObj @>, overallReturnType)
| true, None -> responseUnit.Raw
| false, Some t -> Expr.Coerce(<@ RuntimeHelpers.taskCast t %(task responseObj) @>, overallReturnType)
| false, None -> (task responseUnit).Raw
| false, Some t -> Expr.Coerce(<@ RuntimeHelpers.taskCast t %responseObj @>, overallReturnType)
| false, None -> responseUnit.Raw
| true, Some t -> Expr.Coerce(<@ RuntimeHelpers.asyncCast t %(awaitTask responseObj) @>, overallReturnType)
| true, None -> (awaitTask responseUnit).Raw
)

if not <| String.IsNullOrEmpty(op.Summary) then
Expand Down
Loading