Skip to content

datapith/jayOverlay

Repository files navigation

JSON and YAML overlay

Tool to apply overlays to JSON and YAML files. Overlays are a way to extend or enhance an existing JSON/YAML file by adding, updating or removing fields. By using Overlays to describe and apply the changes the same changes can instantly be re-applied.

How to use

Gradle

Define the overlay you would like to apply, for example the following overlay

{
    "overlay": "0.1.0",
    "info": {
    "title": "Adding description overlay",
    "version": "1.0.0"
},
    "actions": [
        {
            "target": "paths",
            "description": "Adding path to openapi specification",
            "update": {
                "/list" : {
                    "get" : {
                        "description": "Returns a list of stuff",             
                        "responses": {
                            "200": {
                                "description": "Successful response"                                
                            }
                        }
                    }
                }
            }
        }    
    ]
}

will add the path /list to the following OpenApi spec:

{
   "openapi": "3.0.0",
   "info": {
       "version": "1.0.0",
       "title": "API"
   },
   "paths": {}
}           

Add the overlay plugin to your gradle build

plugins {
    id("io.datapith.jayOverlay").version("<<latest>>")
}

jayOverlay {
    targetFile.set("api-specs.yaml")
    overlayFile.set("overlay.json")
    outputDir.set("${projectDir}/result"")
}

About

Tool to apply overlays to JSON and YAML files. Overlays are a way to extend or enhance an existing JSON/YAML file by adding, updating or removing fields.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published