Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a method for external APIs #405

Open
petr-tik opened this issue Apr 15, 2018 · 0 comments
Open

Provide a method for external APIs #405

petr-tik opened this issue Apr 15, 2018 · 0 comments

Comments

@petr-tik
Copy link
Member

As discussed in FFIG/rest-api#14, FFIG API should expose few methods to help CLI or web integration.

@ajbennieston suggested defining an output pipeline with options for writing to disk/keeping in memory, running through code formatting.

output_pipeline = [SourceFormatter('py3'), FileWriter()]
generate_bindings(model, template, output_pipeline)

At a higher level, I think we need to agree on a method signature, which ffig-explorer can use without digging into the internals, like it does currently.

I suggest

def API_func_name(fname=None, source_code=None, bindings_to_generate=["py3", "py3"], autoformat_code=False, save_to_disk=False):
"""
Takes fname or source_code as long-string, generates bindings as requested, formats them or not, before either saving to disk or returning as long strings inside a dictionary of binding_name: source_code
"""

Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant