File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ if (require.main === module) {
99 . python ( {
1010 allowExtraFields : false ,
1111 staticDir : "./src/api/writer-generator/python/static-files" ,
12- fieldFormat : "SnakeCase " ,
12+ fieldFormat : "snake_case " ,
1313 } )
1414 . outputTo ( "./examples/python/fhir_types" )
1515 . cleanOutput ( true ) ;
Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ export class APIBuilder {
265265 const defaultPyOpts : PythonGeneratorOptions = {
266266 ...defaultWriterOpts ,
267267 rootPackageName : "fhir_types" ,
268- fieldFormat : "SnakeCase " ,
268+ fieldFormat : "snake_case " ,
269269 } ;
270270
271271 const opts : PythonGeneratorOptions = {
Original file line number Diff line number Diff line change @@ -38,14 +38,12 @@ const PRIMITIVE_TYPE_MAP: Record<string, string> = {
3838 xhtml : "str" ,
3939} ;
4040
41- type StringFormatKey = "SnakeCase " | "PascalCase" | "CamelCase" | "CapitalCase" | "KebabCase ";
41+ type StringFormatKey = "snake_case " | "PascalCase" | "camelCase " ;
4242
4343const AVAILABLE_STRING_FORMATS : Record < StringFormatKey , ( str : string ) => string > = {
44- SnakeCase : snakeCase ,
44+ snake_case : snakeCase ,
4545 PascalCase : pascalCase ,
46- CamelCase : camelCase ,
47- CapitalCase : capitalCase ,
48- KebabCase : kebabCase ,
46+ camelCase : camelCase ,
4947} ;
5048
5149const PYTHON_KEYWORDS = new Set ( [
@@ -425,7 +423,7 @@ export class Python extends Writer<PythonGeneratorOptions> {
425423 }
426424
427425 private generateResourceTypeField ( schema : RegularTypeSchema ) : void {
428- this . line ( "resource_type : str = Field(" ) ;
426+ this . line ( ` ${ this . nameFormatFunction ( "resourceType" ) } : str = Field(` ) ;
429427 this . indentBlock ( ( ) => {
430428 this . line ( `default='${ schema . identifier . name } ',` ) ;
431429 this . line ( `alias='resourceType',` ) ;
You can’t perform that action at this time.
0 commit comments