Skip to content

Instantly share code, notes, and snippets.

@lmazuel
Last active May 12, 2021 17:33
Show Gist options
  • Save lmazuel/69dcd7447c6aa10ffd2dbd5a94bb2dd6 to your computer and use it in GitHub Desktop.
Save lmazuel/69dcd7447c6aa10ffd2dbd5a94bb2dd6 to your computer and use it in GitHub Desktop.
LLC view brainstorm
# from m4
intpu = "code-model-+no-tags.yuaml"
model = yaml.parse(input)
main_view : LLCClientView = process_model(model)
# from Swagger
input = "myswagger.json"
main_view : LLCClientView = process_swagger(input)
# If I wan to
main_view = LLCClientView(name="DocumentTranslationClient")
main_view.add_operation(LLCOperationView(
name="CancelOperation",
parameter=ParameterView(
type="string(guid)",
namea="id"
)
))
def to_json(): # LLCClientView
for operation in self.operations:
operation.to_json()
main_view.operations[0].to_json()
main_view.serialize()
main_view.to_json() # produces the API view JSON
import json
json.dumps(main_view, encoder=APIViewEncoder())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment