Giter VIP home page Giter VIP logo

js-spec-gen's Introduction

Office JavsScript Spec Maker

This tool is designed to generate Office JavaScript API specification docs based on internal definition/design.

Running this tool involves 3 things:

  1. Setup the input data as described below.
  2. Run intermediary JSON file creation step (genJsonFromMetadata.rb script).
  3. Run the markdown creation step (genMarkdownFromJSON.rb script), which produces the final API spec files. You can copy these files into final destination such as another repository.

Pre-requisites

Ruby interpreter. Version 2.1+

Input data

Metadata definition file

This is an internal metadata defintion file that describes the API structure. This file contains all of the objects, proeprties, relationships, methods, parameters, etc. along with their description. Additional information such as version supported in, etc. are also provided.

File Location

This file is not part of the repository since it contains some internal data. The location of this file is defined in genJsonFromMetadata.rb script file. The path is relative to this script file. If you wish to change the location, do update the line below prior to running the script.

METADATA_FILE_SOURCE = '../../data/WdJscomApi.cs'

Please do not make this part of the repository as it doesn't belong here

Code snippet (example) files

For each of the resources in your object model, create a new file in the specificed folder and add example code that goes with each of the method. You can also define getter and setter examples.

formatting rules for adding example code
  • Name the file as "object name".md. Example workbook.md.
  • For each method, begin with three # symbols and include method signature. Example ### getNotebookById(id: string)
  • Under this line, define the example you wish to include.
  • For getter and setter: begin with three # symbols and follow with the text getter and setter or getter or setter depending on what the object supports.
  • Between code blocks or within a code snippets - DO NOT INCLUDE # symbol for formatting purpose. This will throw off the script.

When the final markdown spec file is created for the resource, these code snippets get included underneath method definition. Getter and setter code snippets are added at the end of the spec file.

Note: Code snippet is an optional information; though highly recommended. If you don't include a code snippet file, the script shows a warning when you run it.

File Location

The location of this folder is at Js-Spec-Gen/api-examples-to-merge. Add one file per resource.

Output markdown spec

The final output files are generated in markdown format.

File Location

The location of final spec files are at Js-Spec-Gen/markdown. It includes one file per object.

Run steps

  1. Setup the input data
  2. change directory to Js-Spec-Gen/scripts folder
  3. Run Json intermediary file creation step: ruby genJsonFromMetadata.rb
  4. Once the above step completes, run the markdown creation step. ruby genMarkdownFromJSON.rb
  5. Find your markdown files in the output folder.

Next version of this tool.

This tool is being enhanced to combine all steps into one sript and provider better support for changing output format through settings. For the time being, please ignore the v2 folder under scripts and also ignore the config folder.

{ "client_id": "dad4b481-a6b7-4cfd-9117-32eed770d4b1", "redirect_uri": "http://localhost:4567/signon", "secret": "AGCifRyMSOMNQr5n36Kb9Pzh0U4oR8cfKQwjXv39ip0=", "persist_changes": true, "auth_url": "login.windows.net/common/oauth2/", "resource": "https://graph.microsoft.com" }

js-spec-gen's People

Contributors

sumurthy avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.