v1.1.3
What's New
- Add optional RefitterSettings in generated IoC registration code
- Introduce --immutable-records CLI tool argument
- Improve telemetry for --settings-file usage
Installation
This is packaged as a .NET Tool and is published to nuget.org. You can install this specific version of this tool like this:
dotnet tool install --global Refitter --version 1.1.3
Features
- Generate single file containing Refit interface and contract types from an OpenAPI spec file
- Supports OpenAPI v2 and v3
- Supports OpenAPI specifications in JSON and YAML formats
- Supports OpenAPI specification validation and error/warning/stats reporting
- Supports generating route, query, header, and body request parameters
- Generate code at build time using rosyln C# source generator Refitter.SourceGenerator
--no-auto-generated-header
CLI tool argument to skip prefixing output file with header--interface-only
CLI tool argument to skip contract type generation--use-api-response
CLI Tool argument to returnIApiResponse<T>
instead ofTask<T>
--internal
CLI tool argument to generate types with theinternal
accessibility modifier--cancellation-tokens
CLI tool argument to generate the Refit interface with CancellationTokens--no-operation-headers
CLI tool argument to skip generating[Header]
parameters--no-logging
CLI tool argument to disable error logging and feature usage tracking--use-iso-date-format
CLI tool argument to explicitly format date query string parameters in ISO standard date format using delimiters (2023-06-15)--multiple-interfaces
CLI tool argument to generate a Refit interface for each endpoint. This may be eitherByEndpoint
orByTag
--settings-file
CLI tool argument to use a .refitter format file and override all other arguments--skip-validation
CLI tool argument to ignore all validation errors and attempt to generate code anyway--match-path
CLI tool argument to only include Paths that match the provided regular expression. May be set multiple times--tag
CLI tool argument to only include Endpoints that contain this tag. May be set multiple times and result in OR'ed evaluation--optional-nullable-parameters
CLI tool argument to make non-required query parameters to optional parameters in Refit interface--operation-name-template
CLI tool argument to append a prefix or suffix to the{operationName}
template. This can also be used to customize the Execute() method name in the interfaces generated when--multiple-interfaces ByEndpoint
is set--trim-unused-schema
CLI tool argument to remove unreferenced components schema to keep the generated output to a minimum--keep-schema
CLI tool argument to specify a collection of regular expressions to force to keep matching schema. This is used together with--trim-unused-schema
--skip-default-additional-properties
CLI tool argument to skip default additional properties--operation-name-generator
CLI tool argument to NSwag IOperationNameGenerator implementation to use.--use-observable-response
CLI tool argument to returnIObservable<T>
Contributions
- Add
matchPath
option in example .refitter file in README by @christianhelle in #146 - Skip default values when collecting feature usages for Analytics by @christianhelle in #145
- Fix documentation regarding
--settings-file
usage by @christianhelle in #152 - Disable support keys if
--no-logging
is specified by @christianhelle in #153 - Mark deprecated operations by @angelofb in #154
- Update docs with details about --no-deprecated-operations by @christianhelle in #155
- Speed up local smoke tests by @christianhelle in #156
- Generate Refit interfaces as partial by @christianhelle in #162
- Optional OpenAPI Path in CLI arguments by @christianhelle in #160
- Introduce
--operation-name-template
command line argument by @angelofb in #164 - Add support for optional parameters via the
--optional-nullable-parameters
CLI argument by @christianhelle in #163 - Update .refitter file format documentation by @christianhelle in #169
- Allow for custom relative output path in .refitter by @Noblix in #172
- Add support for generating IServiceCollection extension methods for registering Refit clients by @christianhelle in #174
- Allow method name customization when generating multiple interfaces by endpoint by @christianhelle in #181
- Use Internal types to improve docfx documentation generation by @christianhelle in #183
- Add support for customizable type and contract generator settings by @christianhelle in #188
- Remove
namespace
settings fromcodeGeneratorSettings
by @christianhelle in #197 - Output filename customization by @christianhelle in #200
- Fix extra close parenthesis in IServiceCollectionExtensions by @christianhelle in #207
- Remove unreferenced schema, add
--trim-unused-schema
&--keep-schema
by @kirides in #199 - Update docs on trimming unused schemas by @christianhelle in #213
- Add
Action<IHttpClientBuilder>?
parameter inConfigureRefitClients()
by @Noblix in #215 - Added InterfaceName to avoid counting in operation names by @edimarquez in #223
- Handle paths that contain colons by @christianhelle in #227
- Ensure
Task<ApiResponse>
is Returned for Void Methods in Generator by @mortenlaursen in #238 - Fix source generator error - System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces' by @christianhelle in #247
- Upgrade to .NET 8.0 by @christianhelle in #250
- Add donation banner for Github Sponsors and buymeacoffee.com by @christianhelle in #252
- Show error reporting suggestion banner upon error by @christianhelle in #254
- Add support for OAS files with external references by @christianhelle in #260
- Fix issue where codeGeneratorSettings arrayType setting is not respected in Refit interface by @christianhelle in #257
- Use OasReader library for loading OAS documents with external references by @christianhelle in #267
- Implement CustomCSharpPropertyNameGenerator by @christianhelle in #271
- Configurable IOperationNameGenerator implementations by @christianhelle in #272
- Update --operation-name-generator options documentation by @christianhelle in #273
- Add new options to .refitter file format docs by @christianhelle in #274
- Serialize OperationNameGenerator enum as string by @christianhelle in #278
- Fix type accessibility deserialization. by @DJ4ddi in #279
- Provide more extensive method documentation. by @DJ4ddi in #281
- Fixed operation name generation names when it has illegal symbols by @yadanilov19 in #283
- Add return type override setting. by @DJ4ddi in #286
- Align file format and output examples in docs by @christianhelle in #285
- Add support for multiple target frameworks by @christianhelle in #292
- fix: AliasAs attribute generation for StreamPart type by @direncancatalkaya in #295
- Added Optional Setting to name the IServiceCollection Extension Method by @robpalm in #298
- Fix response type always nullable under
generateNullableReferenceTypes
by @christianhelle in #304 - JSON schema by @christianhelle in #314
- Generating IObservable type response by @janfolbrecht in #322
- IObservable improvements by @christianhelle in #326
- Change license to MIT by @christianhelle in #327
- Suggest using --skip-validation CLI tool argument validation error by @christianhelle in #329
- Tweak xml docs by @osc-nseguin in #332
- Fix code generator settings that are not of type string/bool by @david-brink-talogy in #335
- Fix Collection-Type item schema was not kept by @kirides in #353
- Add facility to exclude namespaces from generated output file(s) by @dammitjanet in #365
- Fix missing OpenAPI validation result output by @christianhelle in #374
- Update Serializer to write indented JSON by @christianhelle in #384
- Remove SonarAnalyzer.CSharp dependency by @christianhelle in #394
- NSwag v14.0.8 by @renovate in #397
- Add support for Microsoft HTTP Resilience library by @christianhelle in #400
- Add support for generating immutable records by @christianhelle in #409
- UsePolly deprecation warning banner by @christianhelle in #403
- Add optional RefitterSettings in generated IoC registration code by @christianhelle in #413
- Introduce --immutable-records CLI tool argument by @christianhelle in #415
- Improve telemetry for --settings-file usage by @christianhelle in #419
- Resolved issues reported by @Ekkeir , @waylonmtz , @vinaymadupathi, @EEParker, @bielik01, @safakkesikci , @folbrecht, @manuel-fernandez-rodriguez, @kami-poi, @Xeevis, @jods4, @Jappinen, @JeremyBP, @ebarnard
New Contributors
- @DJ4ddi made their first contribution in #279
- @yadanilov19 made their first contribution in #283
- @direncancatalkaya made their first contribution in #295
- @robpalm made their first contribution in #298
- @TimothyMakkison made their first contribution in #306
- @janfolbrecht made their first contribution in #322
- @osc-nseguin made their first contribution in #332
- @david-brink-talogy made their first contribution in #335
- @dammitjanet made their first contribution in #365
What's Changed
- chore(deps): update xunit-dotnet monorepo by @renovate in #410
- chore(deps): update dependency microsoft.extensions.http.polly to v8.0.7 by @renovate in #411
- chore(deps): update dependency microsoft.extensions.http.resilience to v8.7.0 by @renovate in #412
- Add optional RefitterSettings in generated IoC registration code by @christianhelle in #413
- Add Dependency Injection section to docs by @christianhelle in #414
- Introduce --immutable-records CLI tool argument by @christianhelle in #415
- Update dependency Microsoft.CodeAnalysis.CSharp to v4.10.0 by @renovate in #416
- Update nswag monorepo to v14.1.0 by @renovate in #418
- Revert Microsoft.CodeAnalysis.CSharp to v4.8.0 by @christianhelle in #421
- Improve telemetry for --settings-file usage by @christianhelle in #419
Full Changelog: 1.1.1...1.1.3