Skip to content
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

Release v0.4.2 #22

Merged
merged 4 commits into from
Apr 24, 2023
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/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- "release"

env:
VERSION: 0.4.1
VERSION: 0.4.2
NUGET_REPO_URL: "https://api.nuget.org/v3/index.json"

jobs:
Expand Down
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,29 @@ $ refitter --help

```
USAGE:
refitter [URL or file path] [OPTIONS]
refitter [URL or input file] [OPTIONS]

EXAMPLES:
refitter ./openapi.json --namespace "Your.Namespace.Of.Choice.GeneratedCode" --output ./Output.cs
refitter ./openapi.json
refitter https://petstore3.swagger.io/api/v3/openapi.yaml
refitter ./openapi.json --namespace "Your.Namespace.Of.Choice.GeneratedCode" --output ./GeneratedCode.cs
refitter ./openapi.json --namespace "Your.Namespace.Of.Choice.GeneratedCode" --internal
refitter ./openapi.json --output ./IGeneratedCode.cs --interface-only
refitter ./openapi.json --use-api-response

ARGUMENTS:
[URL or file path] URL or file path to OpenAPI Specification file
[URL or input file] URL or file path to OpenAPI Specification file

OPTIONS:
DEFAULT
-h, --help Prints help information
-n, --namespace GeneratedCode Default namespace to use for generated types
-o, --output Output.cs Path to Output file
--no-auto-generated-header Don't add <auto-generated> header to output file
--interface-only Don't generate contract types
--use-api-response Return Task<IApiResponse<T>> instead of Task<T>
DEFAULT
-h, --help Prints help information
-n, --namespace GeneratedCode Default namespace to use for generated types
-o, --output Output.cs Path to Output file
--no-auto-generated-header Don't add <auto-generated> header to output file
--interface-only Don't generate contract types
--use-api-response Return Task<IApiResponse<T>> instead of Task<T>
--internal Set the accessibility of the generated types to internal
(default: public)
```

To generate code from an OpenAPI specifications file, run the following:
Expand Down
71 changes: 59 additions & 12 deletions src/Refitter/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,65 @@

var app = new CommandApp<GenerateCommand>();
app.Configure(
config => config
.SetApplicationName("refitter")
.SetApplicationVersion(typeof(GenerateCommand).Assembly.GetName().Version!.ToString())
.AddExample(
new[]
{
"./openapi.json",
"--namespace",
"\"Your.Namespace.Of.Choice.GeneratedCode\"",
"--output",
"./Output.cs"
}));
config =>
{
var configuration = config
.SetApplicationName("refitter")
.SetApplicationVersion(typeof(GenerateCommand).Assembly.GetName().Version!.ToString());

configuration
.AddExample(
new[]
{
"./openapi.json",
});

configuration
.AddExample(
new[]
{
"https://petstore3.swagger.io/api/v3/openapi.yaml"
});

configuration
.AddExample(
new[]
{
"./openapi.json",
"--namespace",
"\"Your.Namespace.Of.Choice.GeneratedCode\"",
"--output",
"./GeneratedCode.cs"
});

configuration
.AddExample(
new[]
{
"./openapi.json",
"--namespace",
"\"Your.Namespace.Of.Choice.GeneratedCode\"",
"--internal"
});

configuration
.AddExample(
new[]
{
"./openapi.json",
"--output",
"./IGeneratedCode.cs",
"--interface-only"
});

configuration
.AddExample(
new[]
{
"./openapi.json",
"--use-api-response"
});
});
return app.Run(args);

internal sealed class GenerateCommand : AsyncCommand<GenerateCommand.Settings>
Expand Down