RefitGenerator 0.8.3

dotnet tool install --global RefitGenerator --version 0.8.3
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local RefitGenerator --version 0.8.3
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=RefitGenerator&version=0.8.3
                    
nuke :add-package RefitGenerator --version 0.8.3
                    

RefitGenerator

aka regen

nuget

RefitGenerator is a global dotnet tool used to generate Refit client code from OpenApi schemas.

Installation

With .NET 5 installed run: dotnet tool install -g refitgenerator

Usage

Typing regen -h will display a list of parameters:

  • -u or --url - url to OpenApi json or yaml
  • -f or --file - path to OpenApi json or yaml local file
  • -o or --outputDirectory - where to put the generated files
    • defaults to the current directory
  • -p or --projectName - project name and root namespace
    • defaults to the output directory name
  • --groupBy or --groupingStrategy - method of grouping paths into interfaces
    • defaults to FirstTag
    • possible values
      • FirstTag - uses the first tag in the array for the given path
      • MostCommonTag - uses the most used tag, produces the smallest number of interfaces
      • LeastCommonTag - uses the least used tag, produces the largest number of finely grained interfaces
  • -r or --removeIfExists - a flag which controls whether to delete the output directory if exists first
  • --executable - generate a .NET 5 console app with a basic setup instead of .NET Standard 2.0 class library
  • --ignoreAllHeaders - do not include any header parameters in the resulting code
  • --ignoredHeaders - provide a list of headers to ignore, redundant if --ignoreAllHeaders flag is used
  • --addEqualsNullToOptionalParameters - if a method parameter is optional, it is generated with a default value of null
  • --conflictingNameAffix - adds an affix to a property if its name conflicts with the enclosing type name, not validated whether the resulting property name is a valid identifier
    • defaults to Prop
  • --prefixConflictingName - if this flag is set, the --conflictingNameAffix will be a prefix, otherwise it will be a suffix
  • --skipDeprecatedProperties - if this flag is set, schema properties marked as Deprecated are not included in the model

Caveats

  • This tool does not resolve conflicting type names. For instance, if your schema defines a type which generates a class named Environment, you see an error that System.Environment conflicts with YourNamespace.Models.Environment
  • If an object schema has nested, non-reference object schemas, the tool cannot give the nested nice names, so the resulting type name will be ParentType_PropertyName

Dependencies

Try it out

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.8.3 1,354 8/6/2021
0.8.2 506 8/5/2021
0.8.1 533 6/10/2021
0.8.0 526 3/4/2021