@@ -29,7 +29,10 @@ public bool Validate(CodeGenerationModel model)
2929 . ToArray ( ) ;
3030
3131 // Use non-short-circuit operator to collect all compiler errors
32- bool isValid = ValidateActions ( actions ) & ValidateEquivalentPaths ( actions ) & ValidateDuplicateMethods ( actions ) && ValidateAmbiguousActionNames ( actions ) ;
32+ bool isValid = ValidateActions ( actions )
33+ & ValidateEquivalentPaths ( actions )
34+ & ValidateDuplicateMethods ( actions )
35+ & ValidateAmbiguousActionNames ( actions ) ;
3336 return isValid ;
3437 }
3538
@@ -128,7 +131,12 @@ private bool ValidateAmbiguousActionNames(IEnumerable<ActionRegistration> action
128131
129132 private bool ValidateAction ( ActionDefinition action )
130133 {
131- bool isValid = ValidateReservedPathSegments ( action ) && ValidateParameters ( action ) && ValidateBodyAllowedForMethod ( action ) && ValidateMcpDescription ( action ) ;
134+ // Use non-short-circuit operator to collect all compiler errors
135+ bool isValid = ValidateReservedPathSegments ( action )
136+ & ValidateParameters ( action )
137+ & ValidateBodyAllowedForMethod ( action )
138+ & ValidateMcpDescription ( action )
139+ & ValidateIndentJson ( action ) ;
132140 return isValid ;
133141 }
134142
@@ -207,6 +215,28 @@ private bool ValidateMcpDescription(ActionDefinition actionDefinition)
207215 return false ;
208216 }
209217
218+ private bool ValidateIndentJson ( ActionDefinition actionDefinition )
219+ {
220+ SourceLocation ? indentJsonLocation = actionDefinition . FileResponse ? . IndentJson ;
221+ if ( indentJsonLocation == null )
222+ return true ;
223+
224+ bool result = true ;
225+ if ( actionDefinition . Target is ReflectionActionTarget )
226+ {
227+ _logger . LogError ( "The 'indentJson' property is not supported for actions targeting methods in external assemblies" , indentJsonLocation . Value ) ;
228+ result = false ;
229+ }
230+
231+ if ( actionDefinition . FileResponse . MediaType != HttpMediaType . Json )
232+ {
233+ _logger . LogError ( "The 'indentJson' property is only supported for media type 'application/json'" , indentJsonLocation . Value ) ;
234+ result = false ;
235+ }
236+
237+ return result ;
238+ }
239+
210240 // When using the BODY.$RAW property source, the raw body will be passed to as a stream to an SqlParameter.
211241 // The stream will be only accessed asynchronously if one of the async ADO.NET methods is used.
212242 // Otherwise, it will cause this exception in the ASP.NET core host:
0 commit comments