From 5b642fa09ced841a6b33f046740118343d0c313b Mon Sep 17 00:00:00 2001 From: Presti Date: Tue, 29 Apr 2025 13:08:07 +0200 Subject: [PATCH] Add property to allow overwritting generation options. --- .../SchemaGenerator.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/protobuf-net.Grpc.Reflection/SchemaGenerator.cs b/src/protobuf-net.Grpc.Reflection/SchemaGenerator.cs index f566d58..24269f0 100644 --- a/src/protobuf-net.Grpc.Reflection/SchemaGenerator.cs +++ b/src/protobuf-net.Grpc.Reflection/SchemaGenerator.cs @@ -17,7 +17,15 @@ public sealed class SchemaGenerator /// /// Gets or sets the syntax version /// - public ProtoSyntax ProtoSyntax { get; set; } = ProtoSyntax.Proto3; + public ProtoSyntax ProtoSyntax { get => Options.Syntax; set => Options.Syntax = value; } + + /// + /// Gets or sets the options for the generation of the schema. + /// + public SchemaGenerationOptions Options { get; set; } = new SchemaGenerationOptions + { + Syntax = ProtoSyntax.Proto3 + }; /// /// Gets or sets the binder configuration (the default configuration is used if omitted) @@ -118,8 +126,10 @@ public string GetSchema(params Type[] contractTypes) var options = new SchemaGenerationOptions { - Syntax = ProtoSyntax, + Syntax = Options.Syntax, Package = globalPackage, + Flags = Options.Flags, + Origin = Options.Origin, }; options.Services.AddRange(services);