(ctx context.DnoteCtx)
| 224 | } |
| 225 | |
| 226 | func readSchema(ctx context.DnoteCtx) (schema, error) { |
| 227 | var ret schema |
| 228 | |
| 229 | path := getSchemaPath(ctx) |
| 230 | |
| 231 | b, err := os.ReadFile(path) |
| 232 | if err != nil { |
| 233 | return ret, errors.Wrap(err, "Failed to read schema file") |
| 234 | } |
| 235 | |
| 236 | err = yaml.Unmarshal(b, &ret) |
| 237 | if err != nil { |
| 238 | return ret, errors.Wrap(err, "Failed to unmarshal the schema JSON") |
| 239 | } |
| 240 | |
| 241 | return ret, nil |
| 242 | } |
| 243 | |
| 244 | func writeSchema(ctx context.DnoteCtx, s schema) error { |
| 245 | path := getSchemaPath(ctx) |
no test coverage detected