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

custom APIs specifications can be references to a file #86

Open
iislucas opened this issue Jul 31, 2014 · 0 comments
Open

custom APIs specifications can be references to a file #86

iislucas opened this issue Jul 31, 2014 · 0 comments
Assignees
Milestone

Comments

@iislucas
Copy link
Contributor

Currently custom APIs can be defined in a freedom.json file like this:

{
    "name": "log-provider",
    "description": "",
    "app": { "script": "log-provider.js" },
    "constraints": { "isolation": "never" },
    "provides": [ "LogProvider" ],
    "api": {
        "LogProvider": { ... API specified inline here ... }
    },
    "dependencies": [ ... ],
    "permissions": [ ... ]
}

If I have multiple implementation of the same interface, I have to make a new module and include the same API specification within each one.

Proposal: allow APIs to be referenced from a file so you don't need to have multiple copies of the API specification for each implementation. e.g. this could be done by allowing api specification to be a string instead of an object. The string is a relative path to a JSON file that specifies the api. e.g.

{
    "name": "log-provider",
    "description": "",
    "app": { "script": "log-provider.js" },
    "constraints": { "isolation": "never" },
    "provides": [ "LogProvider" ],
    "api": {
        "LogProvider": "logger.api.json"
    },
    "dependencies": [ ... ],
    "permissions": [ ... ]
}

If you want to get a bit fancier, you could make the API specification file a JS that runs in a web-worker and sends a message with the actual object. Then you're not stuck with JSON, you can have comments, and you can support some nicer abbreviations for writing specifications (e.g. Lally's IDL compiler could be used directly). :)

@iislucas iislucas changed the title custom APIs can be referenced to in a file custom APIs specifications can be references to a file Jul 31, 2014
@willscott willscott self-assigned this Dec 13, 2014
@agallant agallant added this to the freedom v0.7 milestone Nov 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants