-
-
Save pcfreak30/c1a6c73450c16f9508c1024b2f5b25f2 to your computer and use it in GitHub Desktop.
akash_dynamic_sdl_schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" | |
"github.com/invopop/jsonschema" | |
"os" | |
"reflect" | |
) | |
func main() { | |
// Create a new reflector | |
r := &jsonschema.Reflector{ | |
RequiredFromJSONSchemaTags: true, | |
AllowAdditionalProperties: true, | |
DoNotReference: true, | |
ExpandedStruct: true, | |
} | |
// Generate the schema from the Manifest type | |
schema := r.ReflectFromType(reflect.TypeOf(manifest.Manifest{})) | |
// Add schema metadata | |
schema.Title = "Akash Deployment Manifest" | |
schema.Description = "JSON Schema for Akash Network deployment manifest" | |
schema.Version = "v2beta2" | |
// Convert to JSON with pretty printing | |
schemaJSON, err := json.MarshalIndent(schema, "", " ") | |
if err != nil { | |
fmt.Printf("Error marshaling schema: %v\n", err) | |
os.Exit(1) | |
} | |
// Print the schema | |
fmt.Println(string(schemaJSON)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment