Реализация на 5

This commit is contained in:
Grbisba
2026-11-17 13:08:13 +03:00
parent 470d9d6f1e
commit 60f48c0337
229 changed files with 74928 additions and 47 deletions
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env python3
"""Convert a temporary generation view to the oapi-codegen 3.0 subset.
Runtime handlers enforce anyOf and required fields; normative contract is untouched.
"""
import json
from pathlib import Path
s=json.loads(Path('contracts/openapi.json').read_text())
for schema in s['components']['schemas'].values():
schema.pop('anyOf',None)
for prop in schema.get('properties',{}).values():
if prop.get('type')==['string','null']:
prop.update(type='string',nullable=True)
# Preserve pointers so handlers can distinguish missing fields from empty values.
for name,field in [('CreateUser','password'),('CreateMessage','text')]:
s['components']['schemas'][name]['properties'][field]['x-go-type-skip-optional-pointer']=False
s['components']['schemas'][name]['required'].remove(field)
print(json.dumps(s))