Giter Club home page Giter Club logo

corn's People

Contributors

a-cloud-ninja avatar jakestanger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

corn's Issues

[Docs] Future plans for type system & type inference?

Hi again @JakeStanger,

I couldn't find any mentions for a plan to adopt/not-to-adopt an advanced type system. Have you considered eventually to implement types? Seems like this could be a great feature and I bet you've already thought about this ;) This could be particularly useful for things like kubernetes-helm customizations, OpenAPI specs, bigger system-level configurations.

Would be great if you could share your plans or thoughts about a more advanced type system somewhere in the docs.

Thanks again for the cornlang, fantastic work!

Improved error handling

The error code is a little messy at the moment, and the library makes heavy use of unwrap. Error code should be refactored and the parser/deserializer should not panic anywhere.

Web playground

Having an official 'playground' web tool capable of converting Corn into the standard 3 outputs could be very useful, and helps advertise it a bit.

Ideally it should support syntax highlighting for all the languages involved. I'm not sure on the logistics of that or the best tools to use yet.

Multi-line strings

Syntax support for multi-line strings should be added.

Something like:

foo = """
multi
line
string
"""

Cannot escape `$` inside strings

Support for input interpolation inside strings has made it impossible in some cases to include a $ in a string that does not belong to an input.

TOML output support

The #[serde(untagged)] attribute causes the TOML serializer to fail, but is required to produce valid JSON/YAML. TOML also does not support any kind of null value so serde fails to serialize None values. At the moment this means TOML is not supported.

Spaces and dots in keys

These are quite common but not currently supported by Corn. Syntax for quoting keys in 'single quotes' should be added to allow this.

Example:

'foo.bar' = "baz" // does *not* expand to `foo = { bar  = "baz" }`

Support for deep object merging

Currently object merging only takes the immediate children into account.

There may be utility in changing this, or adding additional syntax, to perform a 'deep merge', running the merge against every child object.

Issue originates from the below discussion, which compares the feature to Nix's 'attrset merge':

Discussed in https://github.com/orgs/corn-config/discussions/29

Originally posted by fbewivpjsbsby November 6, 2023

  1. What version of corn are you using?
    corn-cli 0.9.2
  2. What is your operating system?
    Windows 10

Description

It is like nixos module, config will merge when you imports config, use // operators or use mkMerge.
Corn is override attrsets now.

Steps to reproduce

  1. Write this in corn file:
let {
  $preferences_user_enable = {
    Value = true
    Status = "user"
  }

  // telemetry
  $policies_disable_telemetry = {
    DisableTelemetry = true
    DisableFirefoxStudies = true
  }
  // #TODO 'raw data' need git version corn
  // theme
  $policies_theme = {
    Preferences = {
      'toolkit.legacyUserProfileCustomizations.stylesheets' = $preferences_user_enable
      'layout.css.backdrop-filter.enabled' = $preferences_user_enable
      'widget.non-native-theme.use-theme-accent' = $preferences_user_enable
    }
  }

  $policies_ech = {
    // ech need enable DNS over HTTPS
    DNSOverHTTPS = {
      Enabled =  true
      ProviderURL = "https://1.1.1.1/dns-query"
      Locked = false
      ExcludedDomains = [""]
    }
    Preferences = {
      'network.dns.echconfig.enabled' = $preferences_user_enable
      'network.dns.http3_echconfig.enabled' = $preferences_user_enable
    }
  }
} in
{
  policies = {
    // telemetry
    ..$policies_disable_telemetry
    // ech
    ..$policies_ech
    // theme
    ..$policies_theme
  }
}
  1. run corn [your corn file name].corn -t json It is override by $policies_theme:
{
  "policies": {
    "DisableTelemetry": true,
    "DisableFirefoxStudies": true,
    "DNSOverHTTPS": {
      "Enabled": true,
      "ProviderURL": "https://1.1.1.1/dns-query",
      "Locked": false,
      "ExcludedDomains": [
        ""
      ]
    },
    "Preferences": {
      "toolkit.legacyUserProfileCustomizations.stylesheets": {
        "Value": true,
        "Status": "user"
      },
      "layout.css.backdrop-filter.enabled": {
        "Value": true,
        "Status": "user"
      },
      "widget.non-native-theme.use-theme-accent": {
        "Value": true,
        "Status": "user"
      }
    }
  }
}

Ability to deserialize into a struct

Currently cornfig::parse returns the a tree of parsed values which isn't super useful for library use. A serde::Deserializer implementation should be written to attempt to deserialize into structs.

It's possible to serialize the Corn output using serde then deserialize it again, but this comes with a lot of overhead and requires shipping another format library.

Allow for more characters in keys

Lots of things need more than alphanumeric strings in keys. Hyphens would be especially useful. Full unicode should maybe be allowed if keys are quoted.

This is currently limiting Corn's use in ironbar.

LSP Support

There should be an LSP uh, thing, to provide full support to VSCode, Vim and all the rest.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.