Commit graph

5 commits

Author SHA1 Message Date
Dan Anglin 71d62ecaf6
refactor: add golangci-lint with code refactoring
Add golangci-lint for linting and refactor the code based on the
feedback from running it.

Changes:

- Add configuration for golangci-lint.
- Break the large function in create.go into smaller ones.
- Rename internal/templateFuncs to internal/templatefuncs to remove
  upper case letters in the package name.
- Add a mage target for lint tests.
2023-08-21 03:07:06 +01:00
Dan Anglin 9e0f5af2e6
fix: use JSON schema to auto-generate the CV type
- Use go generate and a third party tool called jsonschemagen to
  auto-generate the CV data type from the JSON schema.
- Update the schema by changing number to integer to ensure that the
  integers are set to the correct type.
- Refactor some code.
2023-08-18 23:47:41 +01:00
Dan Anglin 831e91a45d
fix: improve spruce-docgen
Improve spruce-docgen by improving how additionalProperties is
unmarshalled. If the value is either true or false then
AdditionalProperties is set to the default schema value.

Update getType to return discovered maps.

Update refType to return UNKNOWN if the ref string is invalid.

Regenerated docs/schema.asciidoc
2023-08-18 15:13:17 +01:00
Dan Anglin 446691719f
small bit of refactoring; refType validate ref string 2023-08-18 14:21:36 +01:00
Dan Anglin b92ab4e437
feat: add JSON schema and document generator
Add the schema for the CV JSON documentation and add an internal tool
called spruce-docgen that generates an AsciiDoc referencing the schema.
2023-08-17 21:51:53 +01:00