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

Reenable Schema Autogeneration for Microsoft.Cdn #3021

Open
t-bzhan opened this issue Mar 13, 2024 · 3 comments
Open

Reenable Schema Autogeneration for Microsoft.Cdn #3021

t-bzhan opened this issue Mar 13, 2024 · 3 comments

Comments

@t-bzhan
Copy link
Contributor

t-bzhan commented Mar 13, 2024

Hi team, we have noticed that the Schema Autogeneration for Microsoft.Cdn has been temporally disabled in this commit: 18ac726.

image

Can you provide more insight regarding to unexpected character error and provide some guidelines to repro it for better diagnosing?

@t-bzhan
Copy link
Contributor Author

t-bzhan commented Mar 13, 2024

I have tried below steps and found no error:

The following steps are no longer necessary for onboarding, but listed here for reference:

  1. Follow the steps listed under Getting Started. The following commands assume you are running in the > generator directory.
  2. Run npm run list-basepaths to discover the specs repo path containing the swagger definitions.
  3. Run npm run generate-single -- --base-path {basePath} to generate schemas for them. Save the console output to file.
  4. Manually remove any existing references to your provider namespace (if any) from schemas/2019-04-01/deploymentTemplate.> json.
  5. Add the {basePath} to the autogenlist array in autogenlist.ts.
  6. Commit all the changed files, and submit a PR to this repo with title "Onboarding {provider} for autogeneration". Include > the full output saved in step 2 as a comment.
  7. Ensure all CI tests pass, and ask the team to review the PR (including tool output) to ensure that all expected resources > have been detected and generated as expected.

This is the output for : npm run generate-single -- --base-path cdn/resource-manager

D:\github\azure-resource-manager-schemas\generator (main -> origin)
λ npm run generate-single -- --base-path cdn/resource-manager

[email protected] generate-single
ts-node cmd/generatesingle --base-path cdn/resource-manager

[C:\Users\bzhan\AppData\Local\Temp\schm_azspc] executing: git fsck
[C:\Users\bzhan\AppData\Local\Temp\schm_azspc] executing: git reset -q .
[C:\Users\bzhan\AppData\Local\Temp\schm_azspc] executing: git checkout -q -- .
[C:\Users\bzhan\AppData\Local\Temp\schm_azspc] executing: git clean -q -fd
[C:\Users\bzhan\AppData\Local\Temp\schm_azspc] executing: git gc
[C:\Users\bzhan\AppData\Local\Temp\schm_azspc] executing: git fetch -q
[C:\Users\bzhan\AppData\Local\Temp\schm_azspc] executing: git checkout -q origin/main
Using autogenlist config:
{
"basePath": "cdn/resource-manager",
"namespace": "Microsoft.Cdn"
}
[D:\github\azure-resource-manager-schemas\generator] executing: D:\github\azure-resource-manager-schemas\generator/node_modules/.bin/autorest.cmd --version=3.0.6374 --use=@autorest/[email protected] --azureresourceschema --output-folder=C:\Users\bzhan\AppData\Local\Temp\i4f4gnwts2 --multiapi --pass-thru:subset-reducer --pass-thru:schema-validator-swagger C:\Users\bzhan\AppData\Local\Temp\schm_azspc\specification\cdn\resource-manager\readme.md
AutoRest code generation utility [cli version: 3.6.3; node: v20.11.1]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info | AutoRest core version selected from configuration: 3.0.6374.

There is a new version of AutoRest available (3.7.1).

You can install the newer version with with npm install -g autorest@latest

Loading AutoRest core 'C:\Users\bzhan.autorest@[email protected]\nodemodules@autorest\core\dist' (3.0.6374)
Installing AutoRest extension '@autorest/azureresourceschema' (3.0.109)
Installed AutoRest extension '@autorest/azureresourceschema' (3.0.109->3.0.109)
[5.79 s] Generation Complete

@Xynoclafe
Copy link
Collaborator

I unfortunately don't have access to the logs anymore to provide more details regarding the error we found during generation.
I will try rebuilding the schema for Microsoft.cdn today. If it passes, I'll re-enable it for autogeneration and it should go in next week. I will provide more details about the error if it fails again

@Xynoclafe
Copy link
Collaborator

@t-bzhan We found a bug when the generate-single command is run in windows, which is why it exited with no errors. You may have noticed that no schemas were generated when you ran the command. We are in the process of checking in a fix for it.

That said, we still encounter an error while generating schemas for Microsoft.cdn, due to some issue with the swagger file. This was for 2024-02-01 API version, though the error may be present in older specs as well.
This is the error that we get:

FATAL: Error parsing swagger file. Unexpected character encountered while parsing value: [. Path 'components.schemas.schemas:148.default', line 1, position 88418.

We can re-enable it for autogeneration once the swagger error has been fixed.

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