feat(contact): Improve Contact information with name, mail and URL
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Matthieu 'JP' DERASSE 2022-08-27 22:00:16 +00:00
parent 05ecb05132
commit 9107f0d36e
Signed by: mderasse
GPG Key ID: 55141C777B16A705
4 changed files with 38 additions and 11 deletions

View File

@ -130,9 +130,17 @@ func runInitAction(cmd *cobra.Command, args []string) {
log.Info("Description of the project:")
config.ProjectDescription = helpers.StringInput()
// ask project owner
// ask project contact
config.ProjectContact = models.ProjectContactStruct{}
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
log.Debug("Get user input for the selected API type")

View File

@ -14,7 +14,13 @@ import (
type apiYamlTemplate struct {
ProjectDescription 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.
@ -45,7 +51,11 @@ func (a APIType) generateAPIYamls(path string, config *models.Config) error {
data := apiYamlTemplate{
ProjectDescription: config.ProjectDescription,
ProjectName: config.ProjectName,
ProjectOwner: config.ProjectOwner,
ProjectContact: apiYamlContact{
Email: config.ProjectContact.Email,
Name: config.ProjectContact.Name,
URL: config.ProjectContact.URL,
},
}
for _, templateFile := range templateFileList {

View File

@ -4,12 +4,19 @@ package models
type Config struct {
ProjectName string `yaml:"project_name"`
ProjectDescription string `yaml:"project_description"`
ProjectOwner string `yaml:"project_owner"`
ProjectContact ProjectContactStruct `yaml:"project_contact"`
ProjectType APITypeName `yaml:"project_type"`
ModulePath *string `yaml:"module_name"`
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.
type FeaturesConfig struct {
DatabaseModels DatabaseModelsConfig `yaml:"database_models"`

View File

@ -5,7 +5,9 @@ info:
title: "{{ .ProjectName }}"
description: "{{ .ProjectDescription }}"
contact:
email: "{{ .ProjectOwner }}"
name: "{{ .ProjectContact.Name }}"
email: "{{ .ProjectContact.Email }}"
url: "{{ .ProjectContact.URL }}"
consumes:
- "application/json"
produces: