feat(contact): Improve Contact information with name, mail and URL
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
05ecb05132
commit
9107f0d36e
12
cmd/init.go
12
cmd/init.go
@ -130,9 +130,17 @@ func runInitAction(cmd *cobra.Command, args []string) {
|
|||||||
log.Info("Description of the project:")
|
log.Info("Description of the project:")
|
||||||
config.ProjectDescription = helpers.StringInput()
|
config.ProjectDescription = helpers.StringInput()
|
||||||
|
|
||||||
// ask project owner
|
// ask project contact
|
||||||
|
config.ProjectContact = models.ProjectContactStruct{}
|
||||||
|
|
||||||
log.Info("Mail address of the developer team:")
|
log.Info("Mail address of the developer team:")
|
||||||
config.ProjectOwner = helpers.StringInput()
|
config.ProjectContact.Email = helpers.StringInput()
|
||||||
|
|
||||||
|
log.Info("Name of the team:")
|
||||||
|
config.ProjectContact.Name = helpers.StringInput()
|
||||||
|
|
||||||
|
log.Info("URL of the contact informatino of the team:")
|
||||||
|
config.ProjectContact.URL = helpers.StringInput()
|
||||||
|
|
||||||
// launch GetInitializeUserInput from selected api type
|
// launch GetInitializeUserInput from selected api type
|
||||||
log.Debug("Get user input for the selected API type")
|
log.Debug("Get user input for the selected API type")
|
||||||
|
@ -14,7 +14,13 @@ import (
|
|||||||
type apiYamlTemplate struct {
|
type apiYamlTemplate struct {
|
||||||
ProjectDescription string
|
ProjectDescription string
|
||||||
ProjectName string
|
ProjectName string
|
||||||
ProjectOwner string
|
ProjectContact apiYamlContact
|
||||||
|
}
|
||||||
|
|
||||||
|
type apiYamlContact struct {
|
||||||
|
Email string
|
||||||
|
Name string
|
||||||
|
URL string
|
||||||
}
|
}
|
||||||
|
|
||||||
// generateAPIYamls will generate a readme based on the given config.
|
// generateAPIYamls will generate a readme based on the given config.
|
||||||
@ -45,7 +51,11 @@ func (a APIType) generateAPIYamls(path string, config *models.Config) error {
|
|||||||
data := apiYamlTemplate{
|
data := apiYamlTemplate{
|
||||||
ProjectDescription: config.ProjectDescription,
|
ProjectDescription: config.ProjectDescription,
|
||||||
ProjectName: config.ProjectName,
|
ProjectName: config.ProjectName,
|
||||||
ProjectOwner: config.ProjectOwner,
|
ProjectContact: apiYamlContact{
|
||||||
|
Email: config.ProjectContact.Email,
|
||||||
|
Name: config.ProjectContact.Name,
|
||||||
|
URL: config.ProjectContact.URL,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, templateFile := range templateFileList {
|
for _, templateFile := range templateFileList {
|
||||||
|
@ -4,12 +4,19 @@ package models
|
|||||||
type Config struct {
|
type Config struct {
|
||||||
ProjectName string `yaml:"project_name"`
|
ProjectName string `yaml:"project_name"`
|
||||||
ProjectDescription string `yaml:"project_description"`
|
ProjectDescription string `yaml:"project_description"`
|
||||||
ProjectOwner string `yaml:"project_owner"`
|
ProjectContact ProjectContactStruct `yaml:"project_contact"`
|
||||||
ProjectType APITypeName `yaml:"project_type"`
|
ProjectType APITypeName `yaml:"project_type"`
|
||||||
ModulePath *string `yaml:"module_name"`
|
ModulePath *string `yaml:"module_name"`
|
||||||
Features FeaturesConfig `yaml:"features"`
|
Features FeaturesConfig `yaml:"features"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ProjectContactStruct contain all contact information for that project.
|
||||||
|
type ProjectContactStruct struct {
|
||||||
|
Name string `yaml:"name"`
|
||||||
|
Email string `yaml:"email"`
|
||||||
|
URL string `yaml:"url"`
|
||||||
|
}
|
||||||
|
|
||||||
// FeaturesConfig structure represent the configuration of all possible features.
|
// FeaturesConfig structure represent the configuration of all possible features.
|
||||||
type FeaturesConfig struct {
|
type FeaturesConfig struct {
|
||||||
DatabaseModels DatabaseModelsConfig `yaml:"database_models"`
|
DatabaseModels DatabaseModelsConfig `yaml:"database_models"`
|
||||||
|
@ -5,7 +5,9 @@ info:
|
|||||||
title: "{{ .ProjectName }}"
|
title: "{{ .ProjectName }}"
|
||||||
description: "{{ .ProjectDescription }}"
|
description: "{{ .ProjectDescription }}"
|
||||||
contact:
|
contact:
|
||||||
email: "{{ .ProjectOwner }}"
|
name: "{{ .ProjectContact.Name }}"
|
||||||
|
email: "{{ .ProjectContact.Email }}"
|
||||||
|
url: "{{ .ProjectContact.URL }}"
|
||||||
consumes:
|
consumes:
|
||||||
- "application/json"
|
- "application/json"
|
||||||
produces:
|
produces:
|
||||||
|
Loading…
Reference in New Issue
Block a user