question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

create schema for `CAPI2` core format

See original GitHub issue

It would be nice to have a schema for defining constraint of the fields defining the CAPI2 core format.

Related: https://github.com/olofk/edalize/issues/288

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
GlenNichollscommented, Jun 22, 2022

I tried for a while to mess with dataclasses for config files and they’re pretty annoying because you have to implement all the validation/transformations in a more verbose way than pydantic. Not only this, but serializing config files isn’t as easy as this with dataclass like pydantic supports:

class Something(BaseModel):
    ...

with open("cfg.file") as f:
  yml = serial blah stuff
data = Something(**yml)

It looks like datamodel-code-generator can generate pydantic models directly from JSON schema to actually validate core files at runtime. I’m not sure how good datamodel-code-generator is, but IMO, I think starting with pydantic basemodel as your code is already python makes sense because you can just export the model to JSON for anyone who wants the schema. I believe that pydantic also has a dataclass identical to the standard lib capable of validation as well.

EDIT: just wanted to provide some ideas as I spent more time than I’d like to admit to test different tools to figure out how to validate config files, document extensively how to write them for users, and also provide extensive documentation about the actual code that parses for devs.

1reaction
proppycommented, May 11, 2022

Yep, this and dataclasses also got mentioned in https://github.com/olofk/edalize/issues/288.

That would be a good way to piggy back on the existing python tooling for doc generation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing core files - FuseSoC Documentation - Read the Docs
Core files are written in YAML syntax and follow the FuseSoC's own CAPI (version 2) schema, which describes the structure of core files...
Read more >
Create schema documents for the Common Data Model
To do so, you'll need to create Common Data Model schema documents. ... entities will represent your data in the Common Data Model...
Read more >
Solved: Event Id 4107 CAPI2 Repeating - Experts Exchange
Description: Reached crypt32 threshold of 50 events and will suspend logging for 60 minutes. Event Xml: <Event xmlns="http://schemas.microsoft ...
Read more >
Citrix Federated Authentication Service (SAML) 2212
Certificates created using the Microsoft CA certificate template named Domain Controller Authentication ... In the Core Components page, click Next.
Read more >
CREATE SCHEMA
The CREATE SCHEMA statement creates a named collection of database objects. The CREATE SCHEMA statement has the following format:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found