#[ProbeJS, custom Schema] Change dump output of type

26 messages · Page 1 of 1 (latest)

oblique ferry
#

hi! im trying to make a schema for lychee
because the format for post actions and contextual conditions is fucked up and objects can be nested (infinitely), i ended up making my own "system" that just bases itself off the recipe component system by writing a "map":

const anyString = Component("anyString");
const anyInt = Component("anyIntNumber");
const anyDouble = Component("anyDoubleNumber");
const bool = Component("bool");

const anyValue = bool.or(anyInt).or(anyDouble).or(anyString);

const jsonMap = anyValue.asMap(anyString);
const component = jsonMap.or(anyValue).asArrayOrSelf() /* Nested objects get "flattened" into an array */.asMap(anyString).asArrayOrSelf();

return component.map(...); // Logic for flattening in mapIn and unflattening in mapOut

however, this makes a very ugly probe output (see attached image); is there any way i could prettify it some? because this sucks for readability, actually

patent vectorBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

oblique ferry
#

bump

oblique ferry
#

bump

oblique ferry
#

babump

oblique ferry
#

bump

#

surely one of these times ill get an answer... surely...

#

well im just joking around i know probe probably isnt built to handle these cases LOL

oblique ferry
#

bump

oblique ferry
#

problem is, this looks like its just for java classes.. i cant find a way to apply this to schema constructors because i have no clue what to target

oblique ferry
#

@opaque field hi... sorry for the ping, i figured that if anyone knew if/how this is doable, it'd be you
im on probe 6.0.1, since i see many things were rewritten afterwards
for the past few days ive been trying to find any leads, fileSaved doesnt seem to run

// server script
ProbeJSEvents.fileSaved(".*", event => {
    console.log("FILESAVED HAS BEEN RUN");
});
``` (same result if `extra` is a regexp, `/.*/`; im trying to first make it match anything before narrowing down the search, and i used the [reference](<https://code.visualstudio.com/docs/editor/glob-patterns>) as a.. reference)
and [`generateDoc`](<https://github.com/Prunoideae/ProbeJS/wiki/02.-Dynamic-Document-Modification#modifying-documents>) doesnt seem like it helps due to hooking into a java class - closest i could find which would help was [`createRecipe`](<https://github.com/KubeJS-Mods/KubeJS/blob/2001/common/src/main/java/dev/latvian/mods/kubejs/recipe/RecipeTypeFunction.java#L47>) (applying a `propertyJson` to it results in no visible changes, despite the logging running and the method existing)
```js
// server script
event.transformDocument(Java.loadClass("dev.latvian.mods.kubejs.recipe.RecipeTypeFunction"), transformer => {
    transformer
    .methods.find(method => method.name === "createRecipe")
    .addPropertyJson({
        type: "property:comment",
        lines: [
            "Test",
            "Comment"
        ]
    });

    console.log("Entered transformer", "found method", (transformer.methods.find(method => method.name === "createRecipe")) !== undefined);
});
#

i should probably say that im in no rush ahaha dont feel pressured to answer as soon as possible i just want to get some semblance of an answer because its been bugging me for a while

opaque field
#

pain it's probably not working anymore

oblique ferry
#

you mean filesaved ?

#

oh actually i think i may be on a too high version of the extension one second

opaque field
#

those features are not implemented in a way that I suppose anyone would use them

oblique ferry
#

currently on 0.3.1 what do i downgrade to, 0.2.1?

#

ah.

opaque field
#

and I have no interest to maintain/keep doc or whatever stuff on them anymore

#

current 1.21 should be the latest version which is way more polished

oblique ferry
#

lychee is also unfortunately not on (neo) 1.21 so i cant quite make the transition

#

ill take it as all this not being possible, then?

opaque field
#

probably

#

unless you know probejs to some extent

oblique ferry
#

unfortunate, but fair enough - thanks! at least now i know i dont have to keep banging my head on the wall ahaha