feat: handle []string or string for pathAlias
All checks were successful
Build and Push Server / build-and-push (push) Successful in 2m52s

This commit is contained in:
Max Richter
2025-10-24 11:44:57 +02:00
parent cb40a76eeb
commit 2b965cb8f7
14 changed files with 60 additions and 34 deletions

Binary file not shown.

View File

@@ -22,8 +22,7 @@
- path: datePublished
- path: articleSection
- path: reviewRating.ratingValue
pathAlias:
- rating
pathAlias: rating
- path: reviewRating.bestRating
value: 5
codec: const

View File

@@ -17,12 +17,10 @@
hidden: true
value: Person
- path: author.name
pathAlias:
- author
pathAlias: author
- path: author.email
- path: datePublished
pathAlias:
- date
pathAlias: date
- path: prepTime
- path: cookTime
- path: recipeYield

View File

@@ -19,11 +19,9 @@
value: Person
hidden: true
- path: datePublished
pathAlias:
- date
pathAlias: date
- path: reviewRating.ratingValue
pathAlias:
- rating
pathAlias: rating
- path: reviewRating.bestRating
codec: const
value: 5

View File

@@ -0,0 +1 @@
import{l as o,a as r}from"../chunks/Dqs1i6nG.js";export{o as load_css,r as start};

View File

@@ -1 +0,0 @@
import{l as o,a as r}from"../chunks/LdOXEBMq.js";export{o as load_css,r as start};

View File

@@ -1 +1 @@
import"../chunks/DsnmJJEf.js";import{i as u}from"../chunks/kadZwC1X.js";import{p as h,o as g,k as l,t as v,l as d,q as x,v as e,x as a,y as _}from"../chunks/bc36GTfJ.js";import{s as o}from"../chunks/B1lAeocp.js";import{s as k,p}from"../chunks/LdOXEBMq.js";const $={get error(){return p.error},get status(){return p.status}};k.updated.check;const m=$;var b=g("<h1> </h1> <p> </p>",1);function z(i,n){h(n,!1),u();var r=b(),t=l(r),c=e(t,!0);a(t);var s=_(t,2),f=e(s,!0);a(s),v(()=>{o(c,m.status),o(f,m.error?.message)}),d(i,r),x()}export{z as component};
import"../chunks/DsnmJJEf.js";import{i as u}from"../chunks/kadZwC1X.js";import{p as h,o as g,k as l,t as v,l as d,q as x,v as e,x as a,y as _}from"../chunks/bc36GTfJ.js";import{s as o}from"../chunks/B1lAeocp.js";import{s as k,p}from"../chunks/Dqs1i6nG.js";const $={get error(){return p.error},get status(){return p.status}};k.updated.check;const m=$;var b=g("<h1> </h1> <p> </p>",1);function z(i,n){h(n,!1),u();var r=b(),t=l(r),c=e(t,!0);a(t);var s=_(t,2),f=e(s,!0);a(s),v(()=>{o(c,m.status),o(f,m.error?.message)}),d(i,r),x()}export{z as component};

View File

@@ -1 +1 @@
{"version":"1761298502118"}
{"version":"1761298975653"}

View File

@@ -6,11 +6,11 @@
<link href="./_app/immutable/assets/0.z6k2NkFs.css" rel="stylesheet">
<link href="./_app/immutable/assets/2.DQ5mJGGf.css" rel="stylesheet">
<link rel="modulepreload" href="./_app/immutable/entry/start.viDKRdx9.js">
<link rel="modulepreload" href="./_app/immutable/chunks/LdOXEBMq.js">
<link rel="modulepreload" href="./_app/immutable/entry/start.DXq0HO7Q.js">
<link rel="modulepreload" href="./_app/immutable/chunks/Dqs1i6nG.js">
<link rel="modulepreload" href="./_app/immutable/chunks/B1lAeocp.js">
<link rel="modulepreload" href="./_app/immutable/chunks/bc36GTfJ.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.BhsVyJUC.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.DiY95TQA.js">
<link rel="modulepreload" href="./_app/immutable/chunks/DsnmJJEf.js">
<link rel="modulepreload" href="./_app/immutable/chunks/DyoUZ9Ht.js">
<link rel="modulepreload" href="./_app/immutable/nodes/0.BxuPCyXV.js">
@@ -39,7 +39,7 @@ My favourite baguette recipe
<script>
{
__sveltekit_sn112w = {
__sveltekit_fb1f8c = {
base: new URL(".", location).pathname.slice(0, -1),
assets: "/_playground"
};
@@ -47,8 +47,8 @@ My favourite baguette recipe
const element = document.currentScript.parentElement;
Promise.all([
import("./_app/immutable/entry/start.viDKRdx9.js"),
import("./_app/immutable/entry/app.BhsVyJUC.js")
import("./_app/immutable/entry/start.DXq0HO7Q.js"),
import("./_app/immutable/entry/app.DiY95TQA.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 2],

Binary file not shown.

View File

@@ -8,21 +8,21 @@ import (
)
type yamlBlock struct {
Path string `yaml:"path"`
Codec string `yaml:"codec"`
Value any `yaml:"value,omitempty"`
Fields []yamlField `yaml:"fields"`
ListTemplate string `yaml:"listTemplate,omitempty"`
Hidden bool `yaml:"hidden,omitempty"`
PathAlias []string `yaml:"pathAlias,omitempty"`
Path string `yaml:"path"`
Codec string `yaml:"codec"`
Value any `yaml:"value,omitempty"`
Fields []yamlField `yaml:"fields"`
ListTemplate string `yaml:"listTemplate,omitempty"`
Hidden bool `yaml:"hidden,omitempty"`
PathAlias StringOrSlice `yaml:"pathAlias,omitempty"`
}
type yamlField struct {
Path string `yaml:"path"`
Value any `yaml:"value,omitempty"`
Codec string `yaml:"codec"`
Hidden bool `yaml:"hidden,omitempty"`
PathAlias []string `yaml:"pathAlias,omitempty"`
Path string `yaml:"path"`
Value any `yaml:"value,omitempty"`
Codec string `yaml:"codec"`
Hidden bool `yaml:"hidden,omitempty"`
PathAlias StringOrSlice `yaml:"pathAlias,omitempty"`
}
func parseYamlTemplate(input Slice) (block Block, err error) {

31
template/yaml_types.go Normal file
View File

@@ -0,0 +1,31 @@
package template
import "errors"
type StringOrSlice []string
func (s *StringOrSlice) UnmarshalYAML(unmarshal func(any) error) error {
var single string
if err := unmarshal(&single); err == nil {
if single == "" {
*s = nil
return nil
}
*s = []string{single}
return nil
}
var multi []string
if err := unmarshal(&multi); err == nil {
*s = multi
return nil
}
var nothing *struct{}
if err := unmarshal(&nothing); err == nil {
*s = nil
return nil
}
return errors.New("expected string, []string, or null")
}