diff --git a/src/NJsonSchema.CodeGeneration.Tests/ApiSurfaceGuard.cs b/src/NJsonSchema.CodeGeneration.Tests/ApiSurfaceGuard.cs new file mode 100644 index 000000000..18e88e331 --- /dev/null +++ b/src/NJsonSchema.CodeGeneration.Tests/ApiSurfaceGuard.cs @@ -0,0 +1,23 @@ +namespace NJsonSchema.CodeGeneration.Tests; + +public class ApiSurfaceGuard +{ + private abstract class TypeResolverBaseApiGuard : TypeResolverBase + { + protected TypeResolverBaseApiGuard(CodeGeneratorSettingsBase settings) : base(settings) + { + } + + // dummy implementation making sure this method stays overridable + public override string GetOrGenerateTypeName(JsonSchema schema, string typeNameHint) + { + throw new System.NotImplementedException(); + } + + // dummy implementation making sure this method stays overridable + public override JsonSchema RemoveNullability(JsonSchema schema) + { + throw new System.NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/src/NJsonSchema.CodeGeneration/TypeResolverBase.cs b/src/NJsonSchema.CodeGeneration/TypeResolverBase.cs index f3d0f1152..2df45ad42 100644 --- a/src/NJsonSchema.CodeGeneration/TypeResolverBase.cs +++ b/src/NJsonSchema.CodeGeneration/TypeResolverBase.cs @@ -84,7 +84,7 @@ public void RegisterSchemaDefinitions(IDictionary definition /// Removes a nullable oneOf reference if available. /// The schema. /// The actually resolvable schema - public JsonSchema RemoveNullability(JsonSchema schema) + public virtual JsonSchema RemoveNullability(JsonSchema schema) { // TODO: Method on JsonSchema4? return schema.OneOf.FirstOrDefault(o => !o.IsNullable(SchemaType.JsonSchema)) ?? schema;