Skip to content

Commit

Permalink
Add SkipSchemas to TsClient plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
vbilopav committed Jun 9, 2024
1 parent dff7860 commit bc9ad6c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 8 deletions.
6 changes: 6 additions & 0 deletions NpgsqlRestClient/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@ public static List<IEndpointCreateHandler> CreateCodeGenHandlers(string connecti
ts.SkipPaths = skipPaths.ToArray();
}

var skipSchemas = GetConfigEnumerable("SkipSchemas", tsClientCfg);
if (skipSchemas is not null)
{
ts.SkipSchemas = skipSchemas.ToArray();
}

handlers.Add(new TsClient(ts));
}

Expand Down
8 changes: 6 additions & 2 deletions NpgsqlRestClient/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,17 @@
//
"SkipRoutineNames": [],
//
// Array of generated function names to skip
// Array of generated function names to skip (without schema)
//
"SkipFunctionNames": [],
//
// Array of url paths to skip
//
"SkipPaths": []
"SkipPaths": [],
//
// Array of schema names to skip
//
"SkipSchemas": []
},

//
Expand Down
8 changes: 4 additions & 4 deletions plugins/NpgsqlRest.TsClient/NpgsqlRest.TsClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageReadmeFile>README.MD</PackageReadmeFile>
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
<Version>1.7.0</Version>
<AssemblyVersion>1.7.0</AssemblyVersion>
<FileVersion>1.7.0</FileVersion>
<PackageVersion>1.7.0</PackageVersion>
<Version>1.8.0</Version>
<AssemblyVersion>1.8.0</AssemblyVersion>
<FileVersion>1.8.0</FileVersion>
<PackageVersion>1.8.0</PackageVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand Down
7 changes: 6 additions & 1 deletion plugins/NpgsqlRest.TsClient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,14 +519,19 @@ public class TsClientOptions(
public string[] SkipRoutineNames { get; set; } = skipRoutineNames ?? [];

/// <summary>
/// Array of generated function names to skip
/// Array of generated function names to skip (without schema)
/// </summary>
public string[] SkipFunctionNames { get; set; } = skipFunctionNames ?? [];

/// <summary>
/// Array of url paths to skip
/// </summary>
public string[] SkipPaths { get; set; } = skipPaths ?? [];

/// <summary>
/// Array of schema names to skip
/// </summary>
public string[] SkipSchemas { get; set; } = skipPaths ?? [];
}
```

Expand Down
4 changes: 4 additions & 0 deletions plugins/NpgsqlRest.TsClient/TsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ void Handle(Routine routine, RoutineEndpoint endpoint)
{
return;
}
if (options.SkipSchemas.Contains(routine.Schema))
{
return;
}
if (options.SkipPaths.Contains(endpoint.Url))
{
return;
Expand Down
7 changes: 6 additions & 1 deletion plugins/NpgsqlRest.TsClient/TsClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,17 @@ public class TsClientOptions(
public string[] SkipRoutineNames { get; set; } = skipRoutineNames ?? [];

/// <summary>
/// Array of generated function names to skip
/// Array of generated function names to skip (without schema)
/// </summary>
public string[] SkipFunctionNames { get; set; } = skipFunctionNames ?? [];

/// <summary>
/// Array of url paths to skip
/// </summary>
public string[] SkipPaths { get; set; } = skipPaths ?? [];

/// <summary>
/// Array of schema names to skip
/// </summary>
public string[] SkipSchemas { get; set; } = skipPaths ?? [];
}

0 comments on commit bc9ad6c

Please sign in to comment.