Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query.create forces optional parameters to required #262

Open
emrekupcuoglu opened this issue Dec 28, 2023 · 4 comments
Open

query.create forces optional parameters to required #262

emrekupcuoglu opened this issue Dec 28, 2023 · 4 comments

Comments

@emrekupcuoglu
Copy link

When creating a new query using the create# method, columns property's optional properties are forced to be required

here when fieldId is used all other parameters should be optional, but instead they are required

  var queryObj = query.create({
    type: "customrecord_sampleconfig",
    columns: [{ fieldId: "custrecord_memoprefix" }],
    condition: {
      fieldId: "custrecord_configurationid",
      operator: query.Operator.IS,
      values: [configurationId],
    },
  }); 
@emrekupcuoglu
Copy link
Author

emrekupcuoglu commented Dec 28, 2023

Same issue is also present in the condition property, e.g. it forces aggregate to be required. I would fix both of them but they not simply optional or required, instead they have rules they follow such as if fieldId is present then formula is not required and vice versa, etc.

@bendemeyer
Copy link

It looks like this is accounted for in the way createColumn and createCondition are handled. Those use type unions to describe when some fields are optional/required based on the presence of other fields. Presumably something similar could be done for the Column & Condition interfaces themselves.

Or alternatively, if altering those interfaces directly would cause other problems, new union types could be made for CreateQueryOptions to reference.

@ShawnTalbert
Copy link
Contributor

ShawnTalbert commented Dec 29, 2023 via email

@MrRob
Copy link
Collaborator

MrRob commented Jan 3, 2024

I'm making all the attributes of query.Column optional except for fieldId. Does that resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants