List<string> not appearing in API explorer + many services not appearing in Locode + relative-paths not respecting HandlerFactoryPath

Two questions, and a small thing:

First – I have a DTO like this:

[AutoApply(Behavior.AuditCreate)]   // this populates columns inherited by AuditBase (for Template class)
public class CreateProcView : ICreateDb<ProcViewDefinition>, IReturn<IdResponse>
{
    [ValidateNotEmpty]
    [ValidateMinimumLength(3)]
    public string ViewName { get; set; }

    [ValidateGreaterThan(0)]
    public int Version { get; set; }
    //[ValidateMinimumLength(1)]
    public List<string> LocationHints { get; set; }

    public bool SingleProc { get; set; }

    //[ValidateMinimumLength(1)]
    //[ValidateRegularExpression(".+/.+")]
    public List<string> ProcessNames { get; set; }

    [ValidateNotEmpty]
    public enAccessLevel AccessLevel { get; set; }

    [ValidateNotEmpty]
    [ValidateMinimumLength(10)]
    [Input(Type="textarea")]    // for auto-UI
    public string ViewDefinition { get; set; }      
}

And in the API explorer, the fields that are of type List does not appear. It does however work to prefill all other fields, then switch to the JSON view, and add the JSON for the lists.
Is it supposed to be like this? I guess there’s no “list input”-type field, right? Any plan for one? Like a text-field w. add-botton, and a way to remove as well?

Second question:
The DTO shown above is of type AutoQuery, correct? Since it has ICreateDb<>. Then why is it not showing up in Locode? What am I doing wrong?

Third thing
The links in the UI, e.g. from API explorer to Locode, seems to be relative to root, like this: /locode/MyDtoName, but this crashes a bit when served under a path such as /api, even if setup in AppHost using HandlerFactoryPath = "api"

There’s no default HTML control for List<string>, but you could use the TagInput component to manage List<string> properties.

I can’t tell why something’s not working without a repro, but Locode needs a way to query the table at a minimum (e.g. QueryDb<ProcViewDefinition>), which from the lack of context can’t tell if it exists or not.

The custom /api path will be interfering with the JSON /api route. Try explicitly disabling it to see if it resolves it:

ConfigurePlugin<PredefinedRoutesFeature>(feature => feature.JsonApiRoute = null);

If it doesn’t can you see if using a different path other than /api still has the issue.

1 Like
  1. Kodus on the TagInput component, it’s really nice and solves the problem!

  2. Locode – I’m probably doing something wrong, like not using fully AutoCRUD, which I think is required for Locode, so let’s forget about that one.

  3. Regarding the “litte boat icon” in the “api explorer” that jumps to Locode for the same service that is selected, I can see in the HTML that it begins with “/”, which doesn’t really work when served under “/api”. I did try both disabling the JSON route, and also switching to another path “/apis”, but with the same result. This is no big issue for me, it’s just a bug report I can always go and edit the URL and add in whatever path that’s needed. It should be easily reproduced as well.