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

Microsoft Graph OpenAPI schema produces invalid code (compile errors) #52

Open
varon opened this issue Mar 21, 2024 · 6 comments
Open

Comments

@varon
Copy link
Contributor

varon commented Mar 21, 2024

https://github.com/microsoftgraph/msgraph-metadata/tree/master/openapi/beta

This builds a project successfully, but that project fails to compile... after 15 minutes of turning my computer into a space heater:

3>Types.fs(21895,31): Error FS1219 : The union case named 'Tags' conflicts with the generated type 'Tags'
3>Types.fs(24405,31): Error FS1219 : The union case named 'Tags' conflicts with the generated type 'Tags'
3>Client.fs(12,6): Error FS0883 : Invalid namespace, module, type or union case name
3>Client.fs(89972,71): Error FS0001 : This expression was expected to have type
    'microsoftgraphchromeOSOnboardingStatus'    
but here has type
    'string'
3>Client.fs(89989,74): Error FS0001 : This expression was expected to have type
    'microsoftgraphchromeOSOnboardingStatus'    
but here has type
    'string'
3>Client.fs(109192,82): Error FS0001 : This expression was expected to have type
    'microsoftgraphglobalDeviceHealthScriptState'    
but here has type
    'string'
3>------- Finished building project: Integrations.MicrosoftGraph. Succeeded: False. Errors: 6. Warnings: 3194
Build completed in 00:15:24.498

Schema was acquired using wget, jq and yj to get it into a suitable form:

wget https://github.com/microsoftgraph/msgraph-metadata/raw/master/openapi/beta/default.yaml
cat default.yaml | yj -yj | jq > default.json

The config is something like:

{
  "schema": "./default.json",
  "output": "../../gen/Integrations.MicrosoftGraph",
  "project": "Integrations.MicrosoftGraph",
  "synchronous": true,
  "emptyDefinitions": "free-form",
  "asyncReturnType": "task",
  "target": "fsharp"
}

Thank you for making this project as well!

@Zaid-Ajaj
Copy link
Owner

Hi there @varon thanks for filing the issue! Is there any chance you could provide a subset of the schema that repro the issue? I think Tags being not supported is known and the fix should be doable but the other two errors, I am not sure about.

@varon
Copy link
Contributor Author

varon commented Mar 23, 2024

Thank you for the quick answer.

Really happy to help - but unfortunately the schema is ~58mb - it may take considerable amounts of time to do that - even editing the file is relatively painful.

Perhaps you could try the wget commands I shared?

there's an honestly insane amount of errors with it - however Kiota works - at least insofar as MSoft is able to generate their Microsoft Graph NuGet package. https://www.nuget.org/packages/Microsoft.Graph/

@varon
Copy link
Contributor Author

varon commented Mar 29, 2024

Any thoughts? Opened up a few smaller PRs - but would love to get the Microsoft schema working with this.

Also tried to upload the schema, but it's too large:
File size too big: 25 MB are allowed, 73 MB were attempted to upload.

@Zaid-Ajaj
Copy link
Owner

Hi @varon unfortunately I haven't had the time to dig into this properly. These days I have my hands full with my day job. I do try prioritize PR reviews and publishing new packages. Contributions are always welcome 🙏

I will keep you posted if/when I can debug this schema

@varon
Copy link
Contributor Author

varon commented Mar 30, 2024

@Zaid-Ajaj - if you can give me some steps on how I can even go about testing/fixing this - I'm happy to give it a go - just need some guidance here.

@Zaid-Ajaj
Copy link
Owner

@varon the easiest way to develop with this tool is to change the contents of ./src/hawaii.config and then run the tool in debug mode (it is just an executable, no magic here)

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

2 participants