Skip to content

Commit

Permalink
Support namespaces in CreateRedoc (#81)
Browse files Browse the repository at this point in the history
* udpate README

* fix redoc with namespaces
  • Loading branch information
ChloePlanet committed Nov 10, 2020
1 parent 8e3c6bd commit 29a8611
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -97,7 +97,7 @@ export SYSL_TOKENS=github.com:<YOUR_TOKEN_HERE>
```

```bash
export SYSL_PLANTUML=http://www.plantuml.com/plantuml`
export SYSL_PLANTUML=http://www.plantuml.com/plantuml
```

On macOS, if your `launchctl limit maxfiles` setting is too low (e.g 256) you might see the error message "too many open files" when running make.
Expand Down
2 changes: 2 additions & 0 deletions pkg/catalog/create_redoc.go
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"os"
"path"
"strings"

"github.com/anz-bank/sysl/pkg/sysl"
"github.com/ghodss/yaml"
Expand Down Expand Up @@ -55,6 +56,7 @@ func (p *Generator) CreateRedoc(app *sysl.Application, appName string) string {
if !IsOpenAPIFile(importPath) {
return ""
}
appName = strings.ReplaceAll(appName, " :: ", "_")
redocOutputPath, _ := CreateFileName(p.CurrentDir, appName+".redoc.html")
redocOutputPath = path.Join(p.OutputDir, redocOutputPath)
var c []byte
Expand Down
6 changes: 3 additions & 3 deletions pkg/catalog/util.go
Expand Up @@ -156,12 +156,12 @@ func JoinAppNameString(an *sysl.AppName) string {
func GetAppPackageName(a Namer) (string, string) {
appName := GetAppNameString(a)
packageName := appName
if attr := a.GetAttrs()[macropackage_name]; attr != nil {
if attr := a.GetAttrs()["package"]; attr != nil {
packageName = attr.GetS()
} else if attr := a.GetAttrs()[macropackage_name]; attr != nil {
packageName = attr.GetS()
} else if len(a.GetName().Part) > 1 {
packageName = strings.Join(a.GetName().Part[:len(a.GetName().Part)-1], namespaceSeparator)
} else if attr := a.GetAttrs()["package"]; attr != nil {
packageName = attr.GetS()
}
return packageName, appName
}
Expand Down

0 comments on commit 29a8611

Please sign in to comment.