License
An optional field that expects a path to the license file. The path should be relative to the pyproject.toml file and should be in the format license = { file = "LICENSE.txt" }.
ChatGPT's suggestion below, just for reference, still need refine @robinjhuang
To update the schema to make the license field accept an object with optional file and text properties, you will need to use the JSON type offered by the Ent framework. You will also need to define a custom Go type to represent this object. Here's how you can achieve this:
Define a License struct in Go to represent the object.
Use the NillableJSON field type provided by Ent to store this object in the database as JSON.
Update the Fields method accordingly.
Here's an updated version of your schema function:
status quo
We have updated license schema in our docs site.
and in cli tools
But fails to publish in the latest schema yet.
The related schema is in here
Expected
schema from toml file standards should be:
license = { file: string } | { text: string }
ChatGPT's suggestion below, just for reference, still need refine @robinjhuang
To update the schema to make the
license
field accept an object with optionalfile
andtext
properties, you will need to use theJSON
type offered by the Ent framework. You will also need to define a custom Go type to represent this object. Here's how you can achieve this:License
struct in Go to represent the object.NillableJSON
field type provided by Ent to store this object in the database as JSON.Fields
method accordingly.Here's an updated version of your schema function:
registry-backend/ent/schema /node.go
In this modification:
License
struct for representing the license object with optionalfile
andtext
properties.Fields
method to usefield.JSON
for thelicense
field.SchemaType
to usejsonb
for PostgreSQL.This allows the
license
field to store a JSON object while maintaining the structure in your Go code.