CodeGenSuppress and CodeGenModel not being applied to AutoRest generated code

73 Views Asked by At

I am attempting to customize two aspects of code generation for a c# client:

  • The name of a model (Person to PersonCustomized via the [CodeGenModel] attribute
  • Suppressing the generation of a method (AddPersonAsync) via the [CodeGenSuppress] attribute.

Open API file / command / options are included in the repro here: https://github.com/rquackenbush/AutoRestCustomizationRepro

Expected behavior

  • The Person model should be generated as PersonCustomized
  • The AddPersonAsync method should not be generated.

Actual Behavior

  • The Person model is being generated as Person
  • The AddPersonAsync method is still being generated.

Question

How do I get the customizations to apply?

1

There are 1 best solutions below

0
RQDQ On

Ahh - you have to specify the folder differently using $(this-folder):

input-file: swagger.json
csharp: true 
output-folder: $(this-folder)/Generated
namespace: AutoRestCustomizationRepro
skip-csproj: true
clear-output-folder: true
override-client-name: AutoRestCustomizationRepro
generation1-convenience-client: true
project-folder: $(this-folder)