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

anyOf option is not available as flag #257

Open
deefha opened this issue May 21, 2024 · 0 comments
Open

anyOf option is not available as flag #257

deefha opened this issue May 21, 2024 · 0 comments

Comments

@deefha
Copy link

deefha commented May 21, 2024

I have and API endpoint with following schema (taken from restish some_api some_endpoint --help:

Option Schema:
{                                                                                                                                                                                                                               
      --id: [                                                                                                                                                                                                                       
        (integer)                                                                                                                                                                                                                   
      ]                                                                                                                                                                                                                             
      --name: (string) Name                                                                                                                                                                                                         
      --content: (string) Content                                                                                                                                                                                                   
      --type: [                                                                                                                                                                                                                     
        (string enum:A,AAAA,CAA,CDNSKEY,CDS,CERT,CNAME,DNAME,DNSKEY,DS,HINFO,HTTPS,LOC,MX,NS,PTR,SMIMEA,SOA,SRV,SSHFP,SVCB,TLSA,TXT,URI) RecordType                                                                                 
      ]                                                                                                                                                                                                                             
      --zone: (string) Zone                                                                                                                                                                                                         
      --zone-type: [                                                                                                                                                                                                                
        (string enum:internal,public,catalog,rpz) ZoneType                                                                                                                                                                          
      ]                                                                                                                                                                                                                             
      --note: (string) Note                                                                                                                                                                                                         
      --owner: [                                                                                                                                                                                                                    
        anyOf{                                                                                                                                                                                                                      
          (integer)                                                                                                                                                                                                                 
          (string)                                                                                                                                                                                                                  
        }                                                                                                                                                                                                                           
      ]                                                                                                                                                                                                                             
      --is-active: (boolean) Is Active                                                                                                                                                                                              
      --ttl: (string) Ttl                                                                                                                                                                                                           
      --limit: (integer min:-1) Limit                                                                                                                                                                                               
      --offset: (integer default:0) Offset                                                                                                                                                                                          
      --order: [                                                                                                                                                                                                                    
        (string enum:id,id_desc,name,name_desc,content,content_desc,type,type_desc,zone,zone_desc,owner,owner_desc,ttl,ttl_desc,is_active,is_active_desc) OutputOrder                                                               
      ]                                                                                                                                                                                                                             
      --accept-language: (string default:en) Accept-Language                                                                                                                                                                        
}

Then in Flags section is this info:

Flags:
      --accept-language string   HTTP header indicating client's preferred natural language. (default "en")
      --content string           Content of the record or pattern to retrieve. The string between the two slashes is evaluated as a regular expression. The wildcard form is also supported.
  -h, --help                     help for get-records
      --id ints                  Internal ID(s) of the record(s) to retrieve.
      --is-active                Retrieve only records in the specified state.
      --limit int                Retrieve the first *limit* records or fewer if not enough records. Use -1 for unlimited.   
                                 *Default value* : 50
      --name string              Name of the record or pattern to retrieve. The string between the two slashes is evaluated as a regular expression. The wildcard form is also supported.
      --note string              Note of the record or pattern to retrieve. The string between the two slashes is evaluated as a regular expression. The wildcard form is also supported.
      --offset int               Skip *offset* records from the beginning of the result.
      --order strings            Sort the result by this field and order (ascending or descending). (default [id])
      --ttl min:max              Retrieve only records with the specified TTL. Possible values are either exact value or range min:max. Examples: `300`, `300:`, `:300`, `300:3600`.
      --type strings             Retrieve only records with the specified type(s).
      --zone string              Retrieve only records belonging to the specified zone(s). The string between the two slashes is evaluated as a regular expression. The wildcard form is also supported.
      --zone-type strings        Retrieve only records of the specified zone type(s).

As you can see, there is no --owner flag, although in the schema is this field defined as anyOf. When I try to use --owner flag, an error appears indeed:

Error: unknown flag: --owner

I can use global -q flag as an workaround (-q owner=johndoe), but it sure will be better if the --owner flag was generated properly.

I assume there is a problem with anyOf type maybe? I found this PR #85 where is future support of anyOf mentioned...

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

1 participant