Git Product home page Git Product logo

Comments (4)

mssalvatore avatar mssalvatore commented on June 1, 2024 1

Sounds like #1 is perhaps the best approach. There may be other reasons in the future we would want a custom schema. Let's just make sure the build script prints a visible warning (use colors if possible) that warns when the schema is not regenerated.

from monkey.

ilija-lazoroski avatar ilija-lazoroski commented on June 1, 2024 1

Sounds like #1 is perhaps the best approach. There may be other reasons in the future we would want a custom schema. Let's just make sure the build script prints a visible warning (use colors if possible) that warns when the schema is not regenerated.

image
Something like this?

from monkey.

cakekoa avatar cakekoa commented on June 1, 2024

The problem started when we updated the plugin build script to generate the config schema based on the options model. Before this, the schemas were generated manually. Now the build script uses pydantic's model_json_schema to generate the schema.

The ransomware target directory options are nullable types. The manually generated schema modeled this by using ["null", "string"] as the type of the field. The pydantic generated schema uses anyOf with one of the options as type: null. This anyOf is rendered by RJSF as a dropdown list.

Pydantic issue discussing anyOf for nullable types
PR adding RJSF's support for nullable types
RJSF documentation on nullable types

from monkey.

cakekoa avatar cakekoa commented on June 1, 2024

Potential solutions:

  1. Provide a manually generated schema for Ransomware, and update the build script to only generate the config schema if one doesn't already exist
  2. Use a custom generator that flattens out the anyOf when generating the schema
  3. Flatten out the anyOf in the Island UI when retrieving the schema from the API
  4. Submit a PR to RJSF to handle this anyOf case

from monkey.

Related Issues (20)

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.