Skip to main content

Module formatter

Module formatter 

Source
Expand description

Formatter: converts a Schema AST back to canonical .nautilus source text.

  • 2-space indentation
  • Blank lines between top-level blocks
  • Column spacing of 1 (padding = max_width - len + 1)
  • Field name column always padded (even for fields with no attributes)
  • Field type column padded only for fields that have attributes
  • Single space between attributes on the same field
  • Key-value pairs in datasource/generator blocks are aligned
  • Blank lines between field groups are preserved (detected via spans)
  • Blank line inserted before model-level @@ attributes
  • Comments are preserved (both inline trailing comments and standalone comment lines)

Functionsยง

format_schema
Format a Schema AST back to canonical .nautilus source text.