mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-27 18:50:41 +00:00
Use ruamel.yaml to format the OpenAPI spec (#892)
Stainless ends up reformatting the YAML when we paste it in the Studio. We cannot have that happen if we are going to ever partially automate stainless config updates. Try ruamel.yaml, specifically `block_seq_indent` to avoid that.
This commit is contained in:
parent
41749944a5
commit
ec3ebb5bcf
4 changed files with 6325 additions and 6455 deletions
|
@ -14,7 +14,7 @@ from datetime import datetime
|
|||
from pathlib import Path
|
||||
|
||||
import fire
|
||||
import yaml
|
||||
import ruamel.yaml as yaml
|
||||
|
||||
from llama_models import schema_utils
|
||||
|
||||
|
@ -61,7 +61,19 @@ def main(output_dir: str):
|
|||
)
|
||||
|
||||
with open(output_dir / "llama-stack-spec.yaml", "w", encoding="utf-8") as fp:
|
||||
yaml.dump(spec.get_json(), fp, allow_unicode=True)
|
||||
y = yaml.YAML()
|
||||
y.default_flow_style = False
|
||||
y.block_seq_indent = 2
|
||||
y.map_indent = 2
|
||||
y.sequence_indent = 4
|
||||
y.sequence_dash_offset = 2
|
||||
y.width = 80
|
||||
y.allow_unicode = True
|
||||
y.explicit_start = True
|
||||
y.dump(
|
||||
spec.get_json(),
|
||||
fp,
|
||||
)
|
||||
|
||||
with open(output_dir / "llama-stack-spec.html", "w") as fp:
|
||||
spec.write_html(fp, pretty_print=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue