@meshery/schemas 0.8.131 → 0.8.133

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +69 -0
  2. package/dist/cloudApi.d.mts +10460 -5916
  3. package/dist/cloudApi.d.ts +10460 -5916
  4. package/dist/cloudApi.js +1 -1
  5. package/dist/cloudApi.mjs +1 -1
  6. package/dist/constructs/v1beta1/credential/Credential.d.mts +41 -39
  7. package/dist/constructs/v1beta1/credential/Credential.d.ts +41 -39
  8. package/dist/constructs/v1beta1/credential/CredentialSchema.js +2 -2
  9. package/dist/constructs/v1beta1/credential/CredentialSchema.mjs +2 -2
  10. package/dist/constructs/v1beta1/event/Event.d.mts +149 -0
  11. package/dist/constructs/v1beta1/event/Event.d.ts +149 -0
  12. package/dist/constructs/v1beta1/event/EventSchema.js +1 -1
  13. package/dist/constructs/v1beta1/event/EventSchema.mjs +1 -1
  14. package/dist/constructs/v1beta1/role/Role.d.mts +90 -36
  15. package/dist/constructs/v1beta1/role/Role.d.ts +90 -36
  16. package/dist/constructs/v1beta1/role/RoleSchema.js +1 -1
  17. package/dist/constructs/v1beta1/role/RoleSchema.mjs +1 -1
  18. package/dist/constructs/v1beta1/token/Token.d.mts +538 -0
  19. package/dist/constructs/v1beta1/token/Token.d.ts +538 -0
  20. package/dist/constructs/v1beta1/token/Token.js +1 -0
  21. package/dist/constructs/v1beta1/token/Token.mjs +0 -0
  22. package/dist/constructs/v1beta1/token/TokenSchema.d.mts +7 -0
  23. package/dist/constructs/v1beta1/token/TokenSchema.d.ts +7 -0
  24. package/dist/constructs/v1beta1/token/TokenSchema.js +2 -0
  25. package/dist/constructs/v1beta1/token/TokenSchema.mjs +2 -0
  26. package/dist/constructs/v1beta1/workspace/Workspace.d.mts +4393 -185
  27. package/dist/constructs/v1beta1/workspace/Workspace.d.ts +4393 -185
  28. package/dist/constructs/v1beta1/workspace/WorkspaceSchema.js +97 -1
  29. package/dist/constructs/v1beta1/workspace/WorkspaceSchema.mjs +97 -1
  30. package/dist/index.js +98 -2
  31. package/dist/index.mjs +98 -2
  32. package/dist/mesheryApi.d.mts +192 -1130
  33. package/dist/mesheryApi.d.ts +192 -1130
  34. package/dist/mesheryApi.js +1 -1
  35. package/dist/mesheryApi.mjs +1 -1
  36. package/package.json +1 -1
package/README.md CHANGED
@@ -477,6 +477,75 @@ paths:
477
477
 
478
478
  ---
479
479
 
480
+ ### `x-generate-db-helpers`
481
+
482
+ Use `x-generate-db-helpers: true` as a **schema-level** annotation (not per-property) on a named component under `components/schemas` to instruct the Go generator to automatically produce SQL driver helper methods (`Scan` and `Value`) for that type.
483
+
484
+ **When to use it**: The annotated schema type must satisfy both conditions:
485
+
486
+ 1. It has a **dedicated OpenAPI schema definition** (i.e., it is a named component with explicit properties, not a generic map).
487
+ 2. It is **persisted as a JSON blob** in a single database column — not spread across a dedicated table with one column per field.
488
+
489
+ **When NOT to use it**: Do not annotate amorphous types that have no fixed schema definition (e.g., a generic `metadata` object). Those fields should use `x-go-type: "core.Map"` instead. Also do not annotate types that map to full database tables with individual columns for each property — those are handled by the normal DB tag generation.
490
+
491
+ #### Example
492
+
493
+ ```yaml
494
+ components:
495
+ schemas:
496
+ Quiz:
497
+ x-generate-db-helpers: true # ← schema-level; not on individual properties
498
+ type: object
499
+ required:
500
+ - id
501
+ - title
502
+ properties:
503
+ id:
504
+ $ref: "../../v1alpha1/core/api.yml#/components/schemas/uuid"
505
+ title:
506
+ type: string
507
+ ```
508
+
509
+ The generator produces `zz_generated.helpers.go` containing:
510
+
511
+ ```go
512
+ func (value *Quiz) Scan(src interface{}) error {
513
+ if src == nil {
514
+ *value = Quiz{}
515
+ return nil
516
+ }
517
+ mapVal := core.Map{}
518
+ if err := mapVal.Scan(src); err != nil {
519
+ return err
520
+ }
521
+ return core.MapToStruct(mapVal, value)
522
+ }
523
+
524
+ func (value Quiz) Value() (driver.Value, error) {
525
+ mapVal, err := core.StructToMap(value)
526
+ if err != nil {
527
+ return nil, err
528
+ }
529
+ return core.Map(mapVal).Value()
530
+ }
531
+ ```
532
+
533
+ These implement Go's `sql.Scanner` and `driver.Valuer` interfaces so the struct is transparently serialized as JSON when reading from or writing to a database column.
534
+
535
+ **Counter-example — `metadata`**: A `metadata` field stored as JSON in the database is intentionally *not* annotated with `x-generate-db-helpers` because it is amorphous — it has no fixed property list. Use `x-go-type: "core.Map"` for those fields instead:
536
+
537
+ ```yaml
538
+ metadata:
539
+ type: object
540
+ additionalProperties: true
541
+ x-go-type: "core.Map"
542
+ x-go-type-skip-optional-pointer: true
543
+ x-oapi-codegen-extra-tags:
544
+ db: "metadata"
545
+ ```
546
+
547
+ ---
548
+
480
549
  ## 🛠️ Advanced Usage (Optional)
481
550
 
482
551
  ### 📌 Custom Generation in `generate.sh`