Return the generated Scala schema module name.
(schema: Schema)
| 63 | |
| 64 | |
| 65 | def scala_module_name(schema: Schema) -> str: |
| 66 | """Return the generated Scala schema module name.""" |
| 67 | package = scala_package_for_schema(schema) |
| 68 | if package: |
| 69 | return _to_pascal_case(package.split(".")[-1]) + "ForyModule" |
| 70 | if schema.source_file and not schema.source_file.startswith("<"): |
| 71 | cleaned = "".join( |
| 72 | char if char.isascii() and (char.isalnum() or char == "_") else "_" |
| 73 | for char in Path(schema.source_file).stem |
| 74 | ) |
| 75 | prefix = _to_pascal_case(cleaned) if cleaned else "Schema" |
| 76 | if not prefix or not (prefix[0].isalpha() or prefix[0] == "_"): |
| 77 | prefix = f"Schema{prefix}" |
| 78 | return prefix + "ForyModule" |
| 79 | return "ForyModule" |
| 80 | |
| 81 | |
| 82 | def scala_source_path(schema: Schema, type_name: str) -> str: |
no test coverage detected