Skip to content

Add support for JSON manifest files#477

Merged
fpseverino merged 4 commits intovapor:mainfrom
fpseverino:json
Mar 27, 2025
Merged

Add support for JSON manifest files#477
fpseverino merged 4 commits intovapor:mainfrom
fpseverino:json

Conversation

@fpseverino
Copy link
Copy Markdown
Member

@fpseverino fpseverino commented Mar 19, 2025

These changes are now available in 19.1.0

While keeping YAML files as the default, add support for parsing manifest files in JSON format

@fpseverino fpseverino requested review from 0xTim and gwynne as code owners March 19, 2025 11:51
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 19, 2025

Codecov Report

Attention: Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.

Project coverage is 40.50%. Comparing base (d3d5976) to head (e92a1a5).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
Sources/VaporToolbox/Vapor.swift 76.92% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #477      +/-   ##
==========================================
+ Coverage   40.35%   40.50%   +0.15%     
==========================================
  Files           7        7              
  Lines         627      632       +5     
==========================================
+ Hits          253      256       +3     
- Misses        374      376       +2     
Files with missing lines Coverage Δ
Sources/VaporToolbox/TemplateManifest.swift 64.58% <ø> (ø)
Sources/VaporToolbox/Vapor.swift 73.97% <76.92%> (-1.03%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Test("Template Manifest")
func templateManifest() throws {
let manifestPath = URL(filePath: #filePath).deletingLastPathComponent().appending(path: "manifest.yml")
@Test("Template Manifest", arguments: ["manifest.yml", "manifest.json"])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

README.md Outdated
If you are creating a custom template and want to dynamically generate the project depending on some variable given to the Toolbox, you have to add to the template a manifest file.

By default, the Toolbox looks for a file named `manifest.yml` in the root of the template, but you can specify a different file path with the `--manifest` flag.
By default, the Toolbox looks for a YAML file named `manifest.yml` in the root of the template, but you can specify a different file path with the `--manifest` flag. You can also write the manifest file in JSON format, specifying the correct file extension in the `--manifest` flag.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we support manifest.json by default as well? So flow would be:

  • Use --manifest flag if provided
  • Fallback to manifest.yml if no flag
  • Fallback to manifest.json if no yaml file
  • Error

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@fpseverino fpseverino requested a review from 0xTim March 21, 2025 14:27
@0xTim 0xTim added the semver-minor Contains new APIs label Mar 21, 2025
@fpseverino fpseverino merged commit 38f8549 into vapor:main Mar 27, 2025
26 checks passed
@fpseverino fpseverino deleted the json branch March 27, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-minor Contains new APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants