initializr

package
v0.0.0-...-f424af9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAcceptHeader = "application/vnd.initializr.v2.2+json"
	DefaultUrl          = "https://start.spring.io"
)

Variables

This section is empty.

Functions

func GenerateProject

func GenerateProject(options Options) error

GenerateProject sends a request to a Spring Initializr instance to create a project based on specified options.

Types

type Metadata

type Metadata struct {
	ArtifactId   MetadataText        `json:"artifactId"`
	BootVersion  MetadataSelect      `json:"bootVersion"`
	Dependencies MetadataMultiSelect `json:"dependencies"`
	Description  MetadataText        `json:"description"`
	GroupId      MetadataText        `json:"groupId"`
	JavaVersion  MetadataSelect      `json:"javaVersion"`
	Language     MetadataSelect      `json:"language"`
	Name         MetadataText        `json:"name"`
	PackageName  MetadataText        `json:"packageName"`
	Packaging    MetadataSelect      `json:"packaging"`
	Type         MetadataSelect      `json:"type"`
	Version      MetadataText        `json:"version"`
}

Metadata is JSON metadata containing settings that can be used to create a new project from the Spring Initializr API.

func FetchMetadata

func FetchMetadata() (metadata Metadata, err error)

FetchMetadata fetches JSON metadata containing settings that can be used to generate a project from the Spring Initializr API.

For reference: https://docs.spring.io/initializr/docs/current/reference/html/#api-guide

type MetadataHierarchy

type MetadataHierarchy struct {
	Name   string          `json:"name"`
	Values []MetadataValue `json:"values"`
}

type MetadataMultiSelect

type MetadataMultiSelect struct {
	Type   MetadataType        `json:"type"`
	Values []MetadataHierarchy `json:"values"`
}

type MetadataSelect

type MetadataSelect struct {
	Type    MetadataType    `json:"type"`
	Default string          `json:"default"`
	Values  []MetadataValue `json:"values"`
}

type MetadataText

type MetadataText struct {
	Type    MetadataType `json:"type"`
	Default string       `json:"default"`
}

type MetadataType

type MetadataType string

type MetadataValue

type MetadataValue struct {
	Description  string `json:"description"`
	Id           string `json:"id"`
	Name         string `json:"name"`
	VersionRange string `json:"versionRange"`
}

type Options

type Options struct {
	ArtifactId   string   `json:"artifactId"`
	BootVersion  string   `json:"bootVersion"`
	Dependencies []string `json:"dependencies"`
	Description  string   `json:"description"`
	GroupId      string   `json:"groupId"`
	JavaVersion  string   `json:"javaVersion"`
	Language     string   `json:"language"`
	Name         string   `json:"name"`
	PackageName  string   `json:"packageName"`
	Packaging    string   `json:"packaging"`
	Type         string   `json:"type"`
	Version      string   `json:"version"`
}

Options represents options for Spring Initializr project creation.

func NewDefaultOptions

func NewDefaultOptions(metadata Metadata) Options

NewDefaultOptions creates options based on Spring Initializr metadata.

func ParseOptions

func ParseOptions(filename string) (options Options, err error)

ParseOptions parses options from a JSON file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL