Hi, I’m trying to use openapi defenition from grow...
# ask-questions
l
Hi, I’m trying to use openapi defenition from growthbook admin with typescript codegen. Seems like for now this spec is invalid • validation errors • undeclared methods & paramethers Does anyone use admin openapi with codegeneration?
I have specific problem with targeting attributes: I want to configure targeting attributes via api, but seems like I can do this only via UI.
r
Hi Bogdan, could you send some screenshots of the specific errors you're seeing? Could you also send a screenshot or copy-paste the generated TypeScript code for the part that isn't working?
The targeting attributes have to at least be set in the Attributes section of the SDK Connection's detail page. They can also be set with the ​`setAttributes`​ method in your application code, in addition to being set in the UI. Here's an example of how to do this in JavaScript:
Copy code
growthbook.setAttributes({  
    id: "123",
    email: "<mailto:hello@growthbook.io|hello@growthbook.io>",
    country: "US",
    url: window.location.href,
    userAgent: navigator.userAgent,
    admin: true,
    age: 50,
});
l
thank you
Hi Bogdan, could you send some screenshots of the specific errors you’re seeing?
Copy code
docker run --rm \                                                                                                                                                         
    -v /docs:/local openapitools/openapi-generator-cli generate \
    -i /local/growthbook-openapi.yaml \
    -g typescript-node --skip-validate-spec \
    -o /local/growthbook-openapi
Copy code
Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
 | Error count: 62, Warning count: 7
Errors: 
        -attribute paths.'/sdk-connections/{id}'(get).responses.200.description is missing
        -attribute paths.'/experiments/{id}/results'(get).responses.200.description is missing
        -attribute paths.'/visual-changesets/{id}/visual-change'(post).responses.200.description is missing
        -attribute paths.'/metrics/{id}'(delete).responses.200.description is missing
        -attribute paths.'/experiments/{id}/visual-changesets'(get).responses.200.description is missing
        -attribute paths.'/saved-groups/{id}'(delete).responses.200.description is missing
        -attribute paths.'/experiments/{id}/visual-changesets'(get).parameters.[id].id is unexpected
        -attribute .components.schemas.VisualChangeset. is not of type `object` (#/components/schemas/VisualChangeset)
For now I resolve this by ussing “skip-validation” flag, and manual changes.
targeting attributes have to at least be set in the Attributes section of the SDK Connection’s detail page.
I want to provision attributes that can be used through UI (admin panel) (attributeSchema) I noticed that config.yaml has attributeSchema, but seems like this configuration part doesn’t work.